BoundaryElement.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "BoundaryElement.hpp"
00030
00031 #include <cassert>
00032
00034
00036
00037
00038 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00039 BoundaryElement<ELEMENT_DIM, SPACE_DIM>::BoundaryElement()
00040 : AbstractTetrahedralElement<ELEMENT_DIM, SPACE_DIM>()
00041 {
00042 }
00043
00044
00045 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00046 BoundaryElement<ELEMENT_DIM, SPACE_DIM>::BoundaryElement(unsigned index, const std::vector<Node<SPACE_DIM>*>& rNodes)
00047 : AbstractTetrahedralElement<ELEMENT_DIM, SPACE_DIM>(index, rNodes)
00048 {
00049 RegisterWithNodes();
00050 }
00051
00052 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00053 BoundaryElement<ELEMENT_DIM, SPACE_DIM>::BoundaryElement(unsigned index, Node<SPACE_DIM>* pNode)
00054 : AbstractTetrahedralElement<ELEMENT_DIM,SPACE_DIM>(index)
00055 {
00056 assert(ELEMENT_DIM == 0);
00057
00058
00059 this->mNodes.push_back(pNode);
00060 RegisterWithNodes();
00061 }
00062
00063 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00064 void BoundaryElement<ELEMENT_DIM, SPACE_DIM>::RegisterWithNodes()
00065 {
00066 for (unsigned i=0; i<this->mNodes.size(); i++)
00067 {
00068 this->mNodes[i]->AddBoundaryElement(this->mIndex);
00069 }
00070 }
00071
00072 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00073 void BoundaryElement<ELEMENT_DIM, SPACE_DIM>::ResetIndex(unsigned index)
00074 {
00075 for (unsigned i=0; i<this->GetNumNodes(); i++)
00076 {
00077 this->mNodes[i]->RemoveBoundaryElement(this->mIndex);
00078 }
00079 this->mIndex = index;
00080 RegisterWithNodes();
00081 }
00082
00083 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00084 void BoundaryElement<ELEMENT_DIM, SPACE_DIM>::MarkAsDeleted()
00085 {
00086 this->mIsDeleted = true;
00087
00088
00089 for (unsigned i=0; i<this->GetNumNodes(); i++)
00090 {
00091 this->mNodes[i]->RemoveBoundaryElement(this->mIndex);
00092 }
00093 }
00094
00095 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00096 void BoundaryElement<ELEMENT_DIM, SPACE_DIM>::UpdateNode(const unsigned& rIndex, Node<SPACE_DIM>* pNode)
00097 {
00098 assert(rIndex < this->mNodes.size());
00099
00100
00101 this->mNodes[rIndex]->RemoveBoundaryElement(this->mIndex);
00102
00103
00104 this->mNodes[rIndex] = pNode;
00105
00106
00107 this->mNodes[rIndex]->AddBoundaryElement(this->mIndex);
00108 }
00109
00110
00112
00114
00115 template class BoundaryElement<0,1>;
00116 template class BoundaryElement<0,2>;
00117 template class BoundaryElement<1,2>;
00118 template class BoundaryElement<0,3>;
00119 template class BoundaryElement<1,3>;
00120 template class BoundaryElement<2,3>;