21 #ifndef bempp_space_hpp
22 #define bempp_space_hpp
24 #include "space_identifier.hpp"
26 #include "../common/common.hpp"
27 #include "bempp/common/config_trilinos.hpp"
30 #include "../common/bounding_box.hpp"
31 #include "../common/not_implemented_error.hpp"
32 #include "../common/deprecated.hpp"
33 #include "../common/shared_ptr.hpp"
34 #include "../common/types.hpp"
35 #include "../fiber/basis.hpp"
36 #include "../fiber/collection_of_basis_transformations.hpp"
37 #include "../fiber/scalar_traits.hpp"
39 #include "../common/armadillo_fwd.hpp"
46 template <
typename ValueType>
class BasisData;
47 template <
typename CoordinateType>
class GeometricalData;
58 class GeometryFactory;
59 template <
int codim>
class Entity;
60 template <
int codim>
class EntityPointer;
61 template <
typename ValueType>
class DiscreteSparseBoundaryOperator;
62 template <
typename ValueType>
class DiscreteBoundaryOperator;
67 GLOBAL_DOFS, FLAT_LOCAL_DOFS
86 template <
typename BasisFunctionType>
114 explicit Space(
const shared_ptr<const Grid>&
grid);
183 shared_ptr<const Grid>
grid()
const {
return m_grid; }
202 "Space::shapeset(): not implemented.\nNote that the "
203 "Space::basis() function has been renamed to shapeset(). "
204 "If you have implemented basis() in a subclass of Space, "
205 "please implement shapeset() instead.");
225 unsigned int level()
const {
return m_level; }
251 "Space::basisFunctionValue(): not implemented.\n"
252 "Note that the Space::shapeFunctionValue() function has "
253 "been renamed to basisFunctionValue(). If you have "
254 "implemented shapeFunctionValue() in a subclass of Space, "
255 "please implement basisFunctionValue() instead.");
281 return m_elementGeometryFactory;
327 std::vector<GlobalDofIndex>& dofs)
const;
344 std::vector<GlobalDofIndex>& dofs,
345 std::vector<BasisFunctionType>& localDofWeights)
const;
348 virtual bool gridIsIdentical(
const Space<BasisFunctionType>& other)
const;
370 const std::vector<GlobalDofIndex>& globalDofs,
371 std::vector<std::vector<LocalDof> >& localDofs)
const;
374 const std::vector<GlobalDofIndex>& globalDofs,
375 std::vector<std::vector<LocalDof> >& localDofs,
376 std::vector<std::vector<BasisFunctionType> >& localDofWeights)
const;
387 const std::vector<FlatLocalDofIndex>& flatLocalDofs,
388 std::vector<LocalDof>& localDofs)
const = 0;
425 arma::Mat<CoordinateType>& points)
const {
426 throw NotImplementedError(
427 "Space::getGlobalDofInterpolationPoints(): not implemented");
438 arma::Mat<CoordinateType>& normals)
const {
439 throw NotImplementedError(
440 "Space::getNormalsAtGlobalDofInterpolationPoints(): not implemented");
450 arma::Mat<CoordinateType>& directions)
const {
451 throw NotImplementedError(
452 "Space::getGlobalDofInterpolationDirections(): not implemented");
473 std::vector<BoundingBox<CoordinateType> >& boundingBoxes)
const {
474 throw NotImplementedError(
"Space::getGlobalDofBoundingBoxes(): "
475 "implementation missing");
489 std::vector<BoundingBox<CoordinateType> >& boundingBoxes)
const {
490 throw NotImplementedError(
"Space::getFlatLocalDofBoundingBoxes(): "
491 "implementation missing");
505 std::vector<Point3D<CoordinateType> >& positions)
const = 0;
519 std::vector<Point3D<CoordinateType> >& positions)
const = 0;
569 const char* fileName,
570 const std::vector<unsigned int>& clusterIdsOfGlobalDofs)
const = 0;
593 const char* fileName,
594 const std::vector<unsigned int>& clusterIdsOfGlobalDofs,
595 DofType dofType)
const;
600 shared_ptr<const Grid> m_grid;
601 shared_ptr<GeometryFactory> m_elementGeometryFactory;
602 unsigned int m_level;
603 std::auto_ptr<GridView> m_view;
620 template <
typename BasisFunctionType>
621 void getAllShapesets(
const Space<BasisFunctionType>& space,
629 template <
typename BasisFunctionType>
636 template <
typename BasisFunctionType>
637 int maximumShapesetOrder(
const Space<BasisFunctionType>& space);
640 template <
typename BasisFunctionType,
typename ResultType>
641 shared_ptr<DiscreteSparseBoundaryOperator<ResultType> >
642 constructOperatorMappingGlobalToFlatLocalDofs(
const Space<BasisFunctionType>& space);
644 template <
typename BasisFunctionType,
typename ResultType>
645 shared_ptr<DiscreteSparseBoundaryOperator<ResultType> >
646 constructOperatorMappingFlatLocalToGlobalDofs(
const Space<BasisFunctionType>& space);
647 #endif // WITH_TRILINOS
Traits of scalar types.
Definition: scalar_traits.hpp:40
shared_ptr< GeometryFactory > elementGeometryFactory() const
Return the GeometryFactory associated with the mesh.
Definition: space.hpp:278
Fiber::ScalarTraits< BasisFunctionType >::ComplexType ComplexType
Equivalent to std::complex<CoordinateType>.
Definition: space.hpp:93
Fiber::CollectionOfShapesetTransformations< CoordinateType > CollectionOfShapesetTransformations
Appropriate instantiation of Fiber::CollectionOfShapesetTransformations.
Definition: space.hpp:96
virtual const Fiber::Shapeset< BasisFunctionType > & shapeset(const Entity< 0 > &element) const
Reference to the shapeset attached to the specified element.
Definition: space.hpp:199
BEMPP_DEPRECATED bool dofsAssigned() const
True if global degrees of freedom have been already assigned to local degrees of freedom, false otherwise.
Definition: space.cpp:172
virtual bool isDiscontinuous() const =0
Return true if each basis function of this space extends over only a single element, false otherwise.
virtual ~Space()
Destructor.
Definition: space.cpp:155
Function space.
Definition: assembled_potential_operator.hpp:35
virtual int codomainDimension() const =0
Dimension of the codomain of the functions.
virtual SpaceIdentifier spaceIdentifier() const =0
Return the identifier of the space.
virtual void getGlobalDofNormals(std::vector< Point3D< CoordinateType > > &normals) const
Retrieve the unit vectors normal to the grid at the positions of global degrees of freedom...
Definition: space.hpp:520
#define BEMPP_DEPRECATED
Macro used to mark deprecated functions or classes.
Definition: deprecated.hpp:41
virtual void getGlobalDofPositions(std::vector< Point3D< CoordinateType > > &positions) const =0
Retrieve the reference positions of global degrees of freedom.
Exception thrown on attempt to access an unimplemented feature.
Definition: not_implemented_error.hpp:32
virtual BEMPP_DEPRECATED const Fiber::Basis< BasisFunctionType > & basis(const Entity< 0 > &element) const
Reference to the shapeset attached to the specified element.
Definition: space.hpp:190
virtual shared_ptr< const Space< BasisFunctionType > > discontinuousSpace(const shared_ptr< const Space< BasisFunctionType > > &self) const =0
Return a shared pointer to an appropriate counterpart to this space, with basis functions extending o...
virtual void flatLocal2localDofs(const std::vector< FlatLocalDofIndex > &flatLocalDofs, std::vector< LocalDof > &localDofs) const =0
Map flat indices of local degrees of freedom to local degrees of freedom.
virtual void global2localDofs(const std::vector< GlobalDofIndex > &globalDofs, std::vector< std::vector< LocalDof > > &localDofs) const
Map global degrees of freedom to local degrees of freedom.
Definition: space.cpp:236
virtual void getFlatLocalDofNormals(std::vector< Point3D< CoordinateType > > &normals) const
Retrieve the unit vectors normal to the grid at the positions of global degrees of freedom...
Definition: space.hpp:532
Space(const shared_ptr< const Grid > &grid)
Constructor.
Definition: space.cpp:137
virtual BEMPP_DEPRECATED const CollectionOfBasisTransformations & shapeFunctionValue() const
Transformation mapping shape functions to basis functions.
Definition: space.hpp:214
int worldDimension() const
Return the underlying world dimension.
Definition: space.cpp:185
virtual shared_ptr< const Space< BasisFunctionType > > barycentricSpace(const shared_ptr< const Space< BasisFunctionType > > &self) const
Return an equivalent space (in terms of global Dofs), but defined using local dofs on the barycentric...
Definition: space.cpp:207
int gridDimension() const
Return the underlying grid dimension.
Definition: space.cpp:179
Fiber::ScalarTraits< BasisFunctionType >::RealType CoordinateType
Type used to represent coordinates.
Definition: space.hpp:91
virtual const CollectionOfShapesetTransformations & basisFunctionValue() const
Transformation mapping shape functions to basis functions.
Definition: space.hpp:249
Collection of shape functions defined on a reference element.
Definition: default_local_assembler_for_operators_on_surfaces_utilities.hpp:34
virtual int domainDimension() const =0
Dimension of the grid on which functions from this space are defined.
virtual void dumpClusterIdsEx(const char *fileName, const std::vector< unsigned int > &clusterIdsOfGlobalDofs, DofType dofType) const
Write a VTK file showing the distribution of global or flat local degrees of freedom into clusters...
Definition: space.cpp:337
virtual ElementVariant elementVariant(const Entity< 0 > &element) const =0
Return current variant of element element.
virtual BEMPP_DEPRECATED void dumpClusterIds(const char *fileName, const std::vector< unsigned int > &clusterIdsOfGlobalDofs) const =0
Write a VTK file showing the distribution of global or flat local degrees of freedom into clusters...
virtual bool isBarycentric() const =0
Return true if space is based on a barycentric refinement.
virtual size_t flatLocalDofCount() const =0
Total number of local degrees of freedom on all elements.
Abstract wrapper of a grid view.
Definition: grid_view.hpp:48
const GridView & gridView() const
Return the grid view of the current space.
Definition: space.cpp:190
shared_ptr< const Grid > grid() const
Shared pointer to the grid on which the functions from this space are defined.
Definition: space.hpp:183
virtual void getGlobalDofs(const Entity< 0 > &element, std::vector< GlobalDofIndex > &dofs) const
Map local degrees of freedom residing on an element to global degrees of freedom. ...
Definition: space.cpp:215
Fiber::CollectionOfBasisTransformations< CoordinateType > CollectionOfBasisTransformations
Appropriate instantiation of Fiber::CollectionOfBasisTransformations.
Definition: space.hpp:99
Space< BasisFunctionType > & operator=(const Space< BasisFunctionType > &other)
Assignment operator.
Definition: space.cpp:160
virtual bool gridIsIdentical(const Space< BasisFunctionType > &other) const
Return true if both spaces act on the same grid.
Definition: space.cpp:196
virtual void getNormalsAtGlobalDofInterpolationPoints(arma::Mat< CoordinateType > &normals) const
Retrieve the unit vectors normal to the grid at the interpolation points of the global degrees of fre...
Definition: space.hpp:431
virtual void getGlobalDofInterpolationPoints(arma::Mat< CoordinateType > &points) const
Retrieve the interpolation points of the global degrees of freedom.
Definition: space.hpp:418
unsigned int level() const
Return the grid level of the current space.
Definition: space.hpp:225
BEMPP_DEPRECATED void assignDofs()
Assign global degrees of freedom to local degrees of freedom.
Definition: space.cpp:167
virtual void getFlatLocalDofPositions(std::vector< Point3D< CoordinateType > > &positions) const =0
Retrieve the reference positions of local degrees of freedom ordered by their flat index...
virtual void getGlobalDofBoundingBoxes(std::vector< BoundingBox< CoordinateType > > &boundingBoxes) const
Retrieve bounding boxes of global degrees of freedom.
Definition: space.hpp:464
virtual size_t globalDofCount() const =0
Number of global degrees of freedom.
virtual void setElementVariant(const Entity< 0 > &element, ElementVariant variant)=0
Set the variant of element element to variant.
Abstract wrapper of an entity of codimension 0.
Definition: entity.hpp:81
virtual void getFlatLocalDofBoundingBoxes(std::vector< BoundingBox< CoordinateType > > &boundingBoxes) const
Retrieve bounding boxes of local degrees of freedom ordered by their flat index.
Definition: space.hpp:480
virtual bool spaceIsCompatible(const Space< BasisFunctionType > &other) const =0
Return true if other is compatible to this space, i.e. the global dofs of the two spaces agree with e...
virtual void getGlobalDofInterpolationDirections(arma::Mat< CoordinateType > &directions) const
Retrieve the interpolation directions of the global degrees of freedom.
Definition: space.hpp:443