Skip to content
Snippets Groups Projects
Commit 31288144 authored by Nicolas Marsic's avatar Nicolas Marsic
Browse files

FunctionSpace cpp

parent c2570748
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,8 @@ set(SRC ...@@ -21,6 +21,8 @@ set(SRC
LocalFunctionSpaceVector.cpp LocalFunctionSpaceVector.cpp
LocalFunctionSpace0Form.cpp LocalFunctionSpace0Form.cpp
LocalFunctionSpace1Form.cpp LocalFunctionSpace1Form.cpp
FunctionSpace.cpp
) )
file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h) file(GLOB HDR RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h)
......
#include "FunctionSpace.h"
using namespace std;
FunctionSpace::FunctionSpace(void){
ebLookUp = new map<Element*, Basis*, ElementComparator>;
}
FunctionSpace::~FunctionSpace(void){
delete ebLookUp;
}
...@@ -16,24 +16,44 @@ ...@@ -16,24 +16,44 @@
--> inheritance: FunctionSpaceScalar & FunctionSapceVector @n --> inheritance: FunctionSpaceScalar & FunctionSapceVector @n
"double or fullVector" interpolate(Element, pyhsical coordinate, coef) @n "double or fullVector" interpolate(Element, pyhsical coordinate, coef) @n
"double or fullVector" interpolate(Element, ref 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{ class FunctionSpace{
private: private:
class ElementComparator{ class ElementComparator{
public:
bool operator()(const Element* a, const Element* b) const; 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: public:
FunctionSpace(void);
~FunctionSpace(void);
void associate(Element& element, Basis& basis); void associate(Element& element, Basis& basis);
void associate(int physical, Basis& basis); void associate(int physical, Basis& basis);
Basis& getBasis(Element& element) const; 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 #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment