00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _MBHEXAHEDRONCELL_H
00024 #define _MBHEXAHEDRONCELL_H
00025
00026 #ifdef _WIN32
00027 #pragma warning(push)
00028 #pragma warning(disable:4250)
00029 #endif
00030
00031 #include <MeshVizXLM/extractors/MxHexahedronCellExtract.h>
00032 #include <MeshVizXLM/mesh/cell/MiVolumeCell.h>
00033 #include <MbMeshVizImpl.h>
00034
00035 class PiMarchingCase;
00036
00074 class MbHexahedronCell : virtual public MiVolumeCell
00075 {
00076 public:
00077
00081 MbHexahedronCell(size_t n0, size_t n1, size_t n2, size_t n3,
00082 size_t n4, size_t n5, size_t n6, size_t n7);
00083
00087 virtual double getVolume(const MiGeometryI* meshGeometry) const
00088 {
00089 return MxHexahedronCellExtract::getVolume(*meshGeometry,this);
00090 }
00091
00095 virtual size_t getNumFacets() const { return 6; }
00096
00100 virtual size_t getNumEdges() const { return 12; }
00101
00105 virtual size_t getNumNodes() const { return 8; }
00106
00112 virtual size_t getNodeIndex(size_t nod) const
00113 {
00114 return m_nodeIds[nod];
00115 }
00116
00126 virtual size_t appendNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes) const;
00127
00128 virtual size_t appendLocalNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes) const;
00129
00130
00131 virtual void getIsosurfTopology(unsigned char caseId, std::vector< std::pair<size_t,size_t> >& edgeList ) const
00132 {
00133 MxHexahedronCellExtract::getIsosurfTopology(caseId, edgeList);
00134 }
00135
00136 virtual unsigned char getMarchingCaseId(std::vector<bool> &nodesSign, size_t beginNodeId=0) const;
00137
00138
00139 virtual MbVec3d getIsoParametricCoord(size_t indexNode) const
00140 {
00141 return MxHexahedronCellExtract::getIsoParametricCoord(indexNode);
00142 }
00143
00144 virtual double getRelativeSize(const MiGeometryI* meshGeometry) const
00145 {
00146 return MxHexahedronCellExtract::getLongestEdgeLength(*meshGeometry,this);
00147 }
00148
00149
00150 virtual bool isPointInsideCell(const MiGeometryI& meshGeometry, const MbVec3d &point, std::vector<double>& weights) const
00151 {
00152 return MxHexahedronCellExtract::isPointInsideCell(meshGeometry,this,point,weights);
00153 }
00154
00155
00156 private:
00160 virtual std::ostream& toStream(std::ostream& s) const;
00161
00162
00163 size_t m_nodeIds[8];
00164 static size_t s_facetNode[6][4];
00165 };
00166
00167
00168 inline
00169 MbHexahedronCell::MbHexahedronCell(size_t n0, size_t n1, size_t n2, size_t n3,
00170 size_t n4, size_t n5, size_t n6, size_t n7)
00171 {
00172 m_nodeIds[0] = n0;
00173 m_nodeIds[1] = n1;
00174 m_nodeIds[2] = n2;
00175 m_nodeIds[3] = n3;
00176 m_nodeIds[4] = n4;
00177 m_nodeIds[5] = n5;
00178 m_nodeIds[6] = n6;
00179 m_nodeIds[7] = n7;
00180 }
00181
00182
00183 inline size_t
00184 MbHexahedronCell::appendNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes) const
00185 {
00186 facetNodes.push_back(m_nodeIds[s_facetNode[facet][0]]);
00187 facetNodes.push_back(m_nodeIds[s_facetNode[facet][1]]);
00188 facetNodes.push_back(m_nodeIds[s_facetNode[facet][2]]);
00189 facetNodes.push_back(m_nodeIds[s_facetNode[facet][3]]);
00190 return 4;
00191 }
00192
00193
00194 inline size_t
00195 MbHexahedronCell::appendLocalNodesIndexOfFacet (size_t facet, std::vector<size_t>& facetNodes) const
00196 {
00197 facetNodes.push_back(s_facetNode[facet][0]);
00198 facetNodes.push_back(s_facetNode[facet][1]);
00199 facetNodes.push_back(s_facetNode[facet][2]);
00200 facetNodes.push_back(s_facetNode[facet][3]);
00201 return 4;
00202 }
00203
00204
00205 inline std::ostream&
00206 MbHexahedronCell::toStream(std::ostream& s) const
00207 {
00208 s << "MbHexahedronCell (" <<
00209 m_nodeIds[0] << "," <<
00210 m_nodeIds[1] << "," <<
00211 m_nodeIds[2] << "," <<
00212 m_nodeIds[3] << "," <<
00213 m_nodeIds[4] << "," <<
00214 m_nodeIds[5] << "," <<
00215 m_nodeIds[6] << "," <<
00216 m_nodeIds[7] <<
00217 ")";
00218 return s;
00219 }
00220
00221 #ifdef _WIN32
00222 #pragma warning(pop)
00223 #endif
00224
00225 #endif
00226
00227
00228