00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MBTETRAHEDRONCELL_H
00024 #define _MBTETRAHEDRONCELL_H
00025
00026 #ifdef _WIN32
00027 #pragma warning(push)
00028 #pragma warning(disable:4250)
00029 #endif
00030
00031 #include <MeshVizXLM/extractors/MxTetrahedronCellExtract.h>
00032 #include <MeshVizXLM/mesh/cell/MiVolumeCell.h>
00033 #include <MbMeshVizImpl.h>
00034
00035 class PiMarchingCase;
00036
00068 class MbTetrahedronCell : virtual public MiVolumeCell
00069 {
00070 public:
00071
00075 MbTetrahedronCell(size_t nodeId0, size_t nodeId1, size_t nodeId2, size_t nodeId3);
00076
00080 double getVolume(const MiGeometryI* meshGeometry) const
00081 {
00082 return MxTetrahedronCellExtract::getVolume(*meshGeometry,this);
00083 }
00084
00088 virtual size_t getNumFacets() const { return 4; }
00089
00093 virtual size_t getNumEdges() const { return 6; }
00094
00098 virtual size_t getNumNodes() const { return 4; }
00099
00100 virtual size_t getNodeIndex(size_t nod) const { return m_nodeIds[nod]; }
00101
00102 virtual size_t appendNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes) const;
00103
00104 virtual void getIsosurfTopology(unsigned char caseId, std::vector< std::pair<size_t,size_t> >& edgeList ) const
00105 {
00106 MxTetrahedronCellExtract::getIsosurfTopology(caseId, edgeList);
00107 }
00108
00109 virtual unsigned char getMarchingCaseId(std::vector<bool> &nodesSign, size_t beginNodeId=0) const;
00110
00111
00112 virtual MbVec3d getIsoParametricCoord(size_t indexNode) const
00113 {
00114 return MxTetrahedronCellExtract::getIsoParametricCoord(indexNode);
00115 }
00116
00117 virtual double getRelativeSize(const MiGeometryI* meshGeometry) const
00118 {
00119 return MxTetrahedronCellExtract::getLongestEdgeLength(*meshGeometry,this);
00120 }
00121
00122
00123 virtual bool isPointInsideCell(const MiGeometryI& meshGeometry, const MbVec3d &point, std::vector<double>& weights) const
00124 {
00125 return MxTetrahedronCellExtract::isPointInsideCell(meshGeometry,this,point,weights);
00126 }
00127
00128 private:
00132 virtual std::ostream& toStream(std::ostream& s) const;
00133
00134 size_t m_nodeIds[4];
00135 static size_t s_facetNode[4][3];
00136 };
00137
00138
00139 inline
00140 MbTetrahedronCell::MbTetrahedronCell(size_t nodeId0, size_t nodeId1, size_t nodeId2, size_t nodeId3)
00141 {
00142 m_nodeIds[0] = nodeId0;
00143 m_nodeIds[1] = nodeId1;
00144 m_nodeIds[2] = nodeId2;
00145 m_nodeIds[3] = nodeId3;
00146 }
00147
00148
00149 inline size_t
00150 MbTetrahedronCell::appendNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes) const
00151 {
00152 facetNodes.push_back(m_nodeIds[s_facetNode[facet][0]]);
00153 facetNodes.push_back(m_nodeIds[s_facetNode[facet][1]]);
00154 facetNodes.push_back(m_nodeIds[s_facetNode[facet][2]]);
00155 return 3;
00156 }
00157
00158
00159 inline std::ostream&
00160 MbTetrahedronCell::toStream(std::ostream& s) const
00161 {
00162 s << "MbTetrahedronCell (" <<
00163 m_nodeIds[0] << "," <<
00164 m_nodeIds[1] << "," <<
00165 m_nodeIds[2] << "," <<
00166 m_nodeIds[3] <<
00167 ")";
00168 return s;
00169 }
00170
00171 #ifdef _WIN32
00172 #pragma warning(pop)
00173 #endif
00174
00175 #endif
00176
00177
00178