3#ifndef DUNE_GRID_IO_FILE_AMIRAMESH_PSURFACE_BOUNDARY_HH 
    4#define DUNE_GRID_IO_FILE_AMIRAMESH_PSURFACE_BOUNDARY_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    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::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::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::PSurface<dim,float>* psurface)
 
  101    psurface::PSurface<dim,float>* getPSurfaceObject()
 
  103      return psurface_.get();
 
  113    static shared_ptr<PSurfaceBoundary<dim> > read(
const std::string& filename)
 
  115      psurface::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::unique_ptr<AmiraMesh> am(AmiraMesh::read(filename.c_str()));
 
  130        DUNE_THROW(IOError, 
"An error has occured while reading " << filename);
 
  133        = (psurface::PSurface<dim,float>*) psurface::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::unique_ptr<psurface::PSurface<dim,float> > psurface_;
 
vector space out of a tensor product of fields.
Definition: fvector.hh:94
 
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:243
 
Dune namespace.
Definition: alignment.hh:10
 
Base class for classes implementing geometries of boundary segments.
Definition: boundarysegment.hh:30