3#ifndef DUNE_GRID_IO_FILE_AMIRAMESH_PSURFACE_BOUNDARY_HH
4#define DUNE_GRID_IO_FILE_AMIRAMESH_PSURFACE_BOUNDARY_HH
6#warning Support for PSurface is deprecated and will be removed after Dune 2.8.
16#include <psurface/PSurface.h>
17#include "psurface/AmiraMeshIO.h"
19#include <psurface/Hdf5IO.h>
23#include <amiramesh/AmiraMesh.h>
39 template <
int dim,
class field_type =
double>
40 class PSurfaceBoundary
42 static_assert((dim==1 or dim==2),
"PSurfaceBoundaries can only have dimensions 1 or 2!");
56 PSurfaceBoundarySegment(
const std::shared_ptr<PSurfaceBoundary<dim, field_type> >& psurfaceBoundary,
int segment)
57 : psurfaceBoundary_(psurfaceBoundary),
67 psurface::StaticVector<field_type, dim> barCoords;
70 barCoords[0] = 1 - local[0] - local[1];
71 barCoords[1] = local[0];
73 barCoords[0] = 1 - local[0];
76 psurface::StaticVector<field_type,dim+1> r;
78 if (!psurfaceBoundary_->getPSurfaceObject()->positionMap(segment_, barCoords, r))
81 for (
int i=0; i<dim+1; i++)
87 std::shared_ptr<PSurfaceBoundary<dim, field_type> > psurfaceBoundary_;
94 PSurfaceBoundary(psurface::PSurface<dim, field_type>* psurface)
105 psurface::PSurface<dim, field_type>* getPSurfaceObject()
107 return psurface_.get();
117 static std::shared_ptr<PSurfaceBoundary<dim, field_type> > read(
const std::string& filename)
119 psurface::PSurface<dim, field_type>* newDomain;
123 if (filename.find(
".h5")==filename.length()-3) {
124 newDomain = psurface::Hdf5IO<field_type,dim>::read(filename);
126 return std::make_shared<PSurfaceBoundary<dim, field_type> >(newDomain);
131 std::unique_ptr<AmiraMesh> am(AmiraMesh::read(filename.c_str()));
134 DUNE_THROW(IOError,
"An error has occurred while reading " << filename);
137 = (psurface::PSurface<dim, field_type>*) psurface::AmiraMeshIO<field_type>::readAmiraMesh(am.get(), filename.c_str());
140 DUNE_THROW(IOError,
"An error has occurred while reading " << filename);
142 return std::make_shared<PSurfaceBoundary<dim, field_type> >(newDomain);
144 DUNE_THROW(IOError,
"The given file is not in a supported format!");
150 std::unique_ptr<psurface::PSurface<dim, field_type> > psurface_;
vector space out of a tensor product of fields.
Definition: fvector.hh:95
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:18
Provide a generic factory class for unstructured grids.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
Dune namespace.
Definition: alignedallocator.hh:11
Base class for classes implementing geometries of boundary segments.
Definition: boundarysegment.hh:92