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
00030
00031
00032
00033
00034
00035
00036 #include "BoundaryElement.hpp"
00037
00038 #include <cassert>
00039
00041
00043
00044
00045 template <unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00046 BoundaryElement<ELEMENT_DIM, SPACE_DIM>::BoundaryElement()
00047 : AbstractTetrahedralElement<ELEMENT_DIM, SPACE_DIM>()
00048 {
00049 }
00050
00051
00052 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00053 BoundaryElement<ELEMENT_DIM, SPACE_DIM>::BoundaryElement(unsigned index, const std::vector<Node<SPACE_DIM>*>& rNodes)
00054 : AbstractTetrahedralElement<ELEMENT_DIM, SPACE_DIM>(index, rNodes)
00055 {
00056 RegisterWithNodes();
00057 }
00058
00059 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00060 BoundaryElement<ELEMENT_DIM, SPACE_DIM>::BoundaryElement(unsigned index, Node<SPACE_DIM>* pNode)
00061 : AbstractTetrahedralElement<ELEMENT_DIM,SPACE_DIM>(index)
00062 {
00063 assert(ELEMENT_DIM == 0);
00064
00065
00066 this->mNodes.push_back(pNode);
00067 RegisterWithNodes();
00068 }
00069
00070 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00071 void BoundaryElement<ELEMENT_DIM, SPACE_DIM>::RegisterWithNodes()
00072 {
00073 for (unsigned i=0; i<this->mNodes.size(); i++)
00074 {
00075 this->mNodes[i]->AddBoundaryElement(this->mIndex);
00076 }
00077 }
00078
00079 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00080 void BoundaryElement<ELEMENT_DIM, SPACE_DIM>::ResetIndex(unsigned index)
00081 {
00082 for (unsigned i=0; i<this->GetNumNodes(); i++)
00083 {
00084 this->mNodes[i]->RemoveBoundaryElement(this->mIndex);
00085 }
00086 this->mIndex = index;
00087 RegisterWithNodes();
00088 }
00089
00090 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00091 void BoundaryElement<ELEMENT_DIM, SPACE_DIM>::MarkAsDeleted()
00092 {
00093 this->mIsDeleted = true;
00094
00095
00096 for (unsigned i=0; i<this->GetNumNodes(); i++)
00097 {
00098 this->mNodes[i]->RemoveBoundaryElement(this->mIndex);
00099 }
00100 }
00101
00102 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00103 void BoundaryElement<ELEMENT_DIM, SPACE_DIM>::UpdateNode(const unsigned& rIndex, Node<SPACE_DIM>* pNode)
00104 {
00105 assert(rIndex < this->mNodes.size());
00106
00107
00108 this->mNodes[rIndex]->RemoveBoundaryElement(this->mIndex);
00109
00110
00111 this->mNodes[rIndex] = pNode;
00112
00113
00114 this->mNodes[rIndex]->AddBoundaryElement(this->mIndex);
00115 }
00116
00117
00119
00121
00122 template class BoundaryElement<0,1>;
00123 template class BoundaryElement<0,2>;
00124 template class BoundaryElement<1,2>;
00125 template class BoundaryElement<0,3>;
00126 template class BoundaryElement<1,3>;
00127 template class BoundaryElement<2,3>;