CuboidMeshConstructor.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 "CuboidMeshConstructor.hpp"
00030 #include "MathsCustomFunctions.hpp"
00031
00032 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00033 void CuboidMeshConstructor<ELEMENT_DIM, SPACE_DIM>::Construct(AbstractTetrahedralMesh<ELEMENT_DIM,SPACE_DIM>& rMesh, unsigned meshRefinementNum, double meshWidth)
00034 {
00035
00036 assert(ELEMENT_DIM == SPACE_DIM || (ELEMENT_DIM == 1 && SPACE_DIM == 3));
00037
00038 mMeshWidth = meshWidth;
00039 assert(meshRefinementNum < 30);
00040
00041
00042 unsigned mesh_size = (unsigned) SmallPow(2, meshRefinementNum+2);
00043 double scaling = mMeshWidth/(double) mesh_size;
00044 rMesh.ConstructRegularSlabMesh(scaling, mMeshWidth, mMeshWidth, mMeshWidth);
00045 mNumElements = rMesh.GetNumElements();
00046 mNumNodes = rMesh.GetNumNodes();
00047 }
00048
00049 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00050 double CuboidMeshConstructor<ELEMENT_DIM, SPACE_DIM>::GetWidth()
00051 {
00052 return mMeshWidth;
00053 }
00054
00055 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00056 unsigned CuboidMeshConstructor<ELEMENT_DIM, SPACE_DIM>::GetNumElements()
00057 {
00058 return mNumElements;
00059 }
00060
00061 template<unsigned ELEMENT_DIM, unsigned SPACE_DIM>
00062 unsigned CuboidMeshConstructor<ELEMENT_DIM, SPACE_DIM>::GetNumNodes()
00063 {
00064 return mNumNodes;
00065 }
00066
00068
00070
00071 template class CuboidMeshConstructor<1>;
00072 template class CuboidMeshConstructor<2>;
00073 template class CuboidMeshConstructor<3>;
00074 template class CuboidMeshConstructor<1,3>;