diff --git a/FunctionSpace/CMakeLists.txt b/FunctionSpace/CMakeLists.txt index 5554606cc1ad432b55bb66c9cb5eb6aea65aaa4e..bc9f4a22cd5d3cf16a3759c5484393410e9f9dfa 100644 --- a/FunctionSpace/CMakeLists.txt +++ b/FunctionSpace/CMakeLists.txt @@ -21,6 +21,8 @@ set(SRC LocalFunctionSpaceVector.cpp LocalFunctionSpace0Form.cpp LocalFunctionSpace1Form.cpp + + FunctionSpace.cpp ) file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) diff --git a/FunctionSpace/FunctionSpace.cpp b/FunctionSpace/FunctionSpace.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ede8dada0ef57741dfc4dad1b3539bdc674e1f6e --- /dev/null +++ b/FunctionSpace/FunctionSpace.cpp @@ -0,0 +1,12 @@ +#include "FunctionSpace.h" + +using namespace std; + +FunctionSpace::FunctionSpace(void){ + ebLookUp = new map<Element*, Basis*, ElementComparator>; +} + +FunctionSpace::~FunctionSpace(void){ + delete ebLookUp; +} + diff --git a/FunctionSpace/FunctionSpace.h b/FunctionSpace/FunctionSpace.h index cc8ed83a26b60442af6ced4f32a025df47fa3bb6..cd5aaa420323082b24f266e2ae0ecb7d92ad609e 100644 --- a/FunctionSpace/FunctionSpace.h +++ b/FunctionSpace/FunctionSpace.h @@ -16,24 +16,44 @@ --> inheritance: FunctionSpaceScalar & FunctionSapceVector @n "double or fullVector" interpolate(Element, pyhsical coordinate, coef) @n "double or fullVector" interpolate(Element, ref coordinate , coef) @n - "double or fullVector" interpolate(physical coordinate, coef) --> use octree @n - + "double or fullVector" interpolate(physical coordinate, coef) --> use octree?? @n */ class FunctionSpace{ private: + class ElementComparator{ + public: bool operator()(const Element* a, const Element* b) const; }; - std::map<Element*, Basis*, ElementComparator>* ETBL; // Element To Basis Lookup + std::map<Element*, Basis*, ElementComparator>* ebLookUp; // Element to Basis Lookup public: - + FunctionSpace(void); + ~FunctionSpace(void); + void associate(Element& element, Basis& basis); void associate(int physical, Basis& basis); Basis& getBasis(Element& element) const; }; +////////////////////// +// Inline Functions // +////////////////////// + +inline void FunctionSpace::associate(Element& element, Basis& basis){ + ebLookUp->insert(std::pair<Element*, Basis*>(&element, &basis)); +} + +inline Basis& FunctionSpace::getBasis(Element& element) const{ + return *(ebLookUp->find(&element)->second); +} + +inline bool FunctionSpace::ElementComparator::operator() +(const Element* a, const Element* b) const{ + return a->getId() < b->getId(); +} + #endif