3#ifndef PSURFACE_BOUNDARY_HH
4#define PSURFACE_BOUNDARY_HH
9#include "../../../common/gridfactory.hh"
12#include <psurface/PSurface.h>
13#include "psurface/AmiraMeshIO.h"
15#include <psurface/Hdf5IO.h>
19#include <amiramesh/AmiraMesh.h>
36 class PSurfaceBoundary
38 dune_static_assert((dim==1 or dim==2),
"PSurfaceBoundaries can only have dimensions 1 or 2!");
52 PSurfaceBoundarySegment(
const shared_ptr<PSurfaceBoundary<dim> >& psurfaceBoundary,
int segment)
53 : psurfaceBoundary_(psurfaceBoundary),
63 PSURFACE_NAMESPACE StaticVector<float,dim> barCoords;
66 barCoords[0] = 1 - local[0] - local[1];
67 barCoords[1] = local[0];
69 barCoords[0] = 1 - local[0];
72 PSURFACE_NAMESPACE StaticVector<float,dim+1> r;
74 if (!psurfaceBoundary_->getPSurfaceObject()->positionMap(segment_, barCoords, r))
77 for (
int i=0; i<dim+1; i++)
83 shared_ptr<PSurfaceBoundary<dim> > psurfaceBoundary_;
90 PSurfaceBoundary(PSURFACE_NAMESPACE PSurface<dim,float>* psurface)
101 PSURFACE_NAMESPACE PSurface<dim,float>* getPSurfaceObject()
103 return psurface_.get();
113 static shared_ptr<PSurfaceBoundary<dim> > read(
const std::string& filename)
115 PSURFACE_NAMESPACE PSurface<dim,float>* newDomain;
119 if (filename.find(
".h5")==filename.length()-3) {
120 newDomain = psurface::Hdf5IO<float,dim>::read(filename);
122 return make_shared<PSurfaceBoundary<dim> >(newDomain);
127 std::auto_ptr<AmiraMesh> am(AmiraMesh::read(filename.c_str()));
130 DUNE_THROW(IOError,
"An error has occured while reading " << filename);
133 = (PSURFACE_NAMESPACE PSurface<dim,float>*) PSURFACE_NAMESPACE AmiraMeshIO<float>::readAmiraMesh(am.get(), filename.c_str());
136 DUNE_THROW(IOError,
"An error has occured while reading " << filename);
138 return make_shared<PSurfaceBoundary<dim> >(newDomain);
140 DUNE_THROW(IOError,
"The given file is not in a supported format!");
146 std::auto_ptr<PSURFACE_NAMESPACE PSurface<dim,float> > psurface_;
vector space out of a tensor product of fields.
Definition: fvector.hh:92
Base class for exceptions in Dune grid modules.
Definition: exceptions.hh:18
#define dune_static_assert(COND, MSG)
Helper template so that compilation fails if condition is not true.
Definition: static_assert.hh:79
#define DUNE_THROW(E, m)
Definition: exceptions.hh:244
Dune namespace.
Definition: alignment.hh:14
Base class for classes implementing geometries of boundary segments.
Definition: boundarysegment.hh:30