From: nadir Date: Mon, 24 Nov 2003 13:21:17 +0000 (+0000) Subject: changes due to the fact that Tetra_3D has been replaced by NETGEN_3D. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1a192585a9d11b6154f07fd708c1bbfb181c6cba;p=modules%2Fsmesh.git changes due to the fact that Tetra_3D has been replaced by NETGEN_3D. --- diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl index c003426c8..5b8d964ba 100644 --- a/idl/SMESH_BasicHypothesis.idl +++ b/idl/SMESH_BasicHypothesis.idl @@ -79,7 +79,7 @@ module SMESH { }; - interface SMESH_Tetra_3D : SMESH_3D_Algo + interface SMESH_NETGEN_3D : SMESH_3D_Algo { }; }; diff --git a/src/SMESH/Makefile.in b/src/SMESH/Makefile.in index 8de62e1ea..e6282c300 100644 --- a/src/SMESH/Makefile.in +++ b/src/SMESH/Makefile.in @@ -96,8 +96,8 @@ CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lOpUtil -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV -L${KERNEL_ROOT_DIR}/lib/salome ifeq (@WITHNETGEN@,yes) - EXPORT_HEADERS+= SMESH_Tetra_3D.hxx - LIB_SRC+= SMESH_Tetra_3D.cxx + EXPORT_HEADERS+= SMESH_NETGEN_3D.hxx + LIB_SRC+= SMESH_NETGEN_3D.cxx NETGEN_INCLUDES=@NETGEN_INCLUDES@ CPPFLAGS+= $(NETGEN_INCLUDES) CXXFLAGS+= $(NETGEN_INCLUDES) diff --git a/src/SMESH/SMESH_HypothesisFactory.cxx b/src/SMESH/SMESH_HypothesisFactory.cxx index c7ad83a10..f33ae801d 100644 --- a/src/SMESH/SMESH_HypothesisFactory.cxx +++ b/src/SMESH/SMESH_HypothesisFactory.cxx @@ -46,7 +46,7 @@ using namespace std; #include "SMESH_MEFISTO_2D.hxx" #include "SMESH_Quadrangle_2D.hxx" #include "SMESH_Hexa_3D.hxx" -#include "SMESH_Tetra_3D.hxx" +#include "SMESH_NETGEN_3D.hxx" //--------------------------------------- @@ -94,7 +94,7 @@ _creatorMap["Regular_1D"] = new SMESH_HypothesisCreator; _creatorMap["MEFISTO_2D"] = new SMESH_HypothesisCreator; _creatorMap["Quadrangle_2D"] = new SMESH_HypothesisCreator; _creatorMap["Hexa_3D"] = new SMESH_HypothesisCreator; -_creatorMap["Tetra_3D"] = new SMESH_HypothesisCreator; +_creatorMap["NETGEN_3D"] = new SMESH_HypothesisCreator; //--------------------------------------- } diff --git a/src/SMESH/SMESH_NETGEN_3D.cxx b/src/SMESH/SMESH_NETGEN_3D.cxx new file mode 100644 index 000000000..2c9de3b88 --- /dev/null +++ b/src/SMESH/SMESH_NETGEN_3D.cxx @@ -0,0 +1,1027 @@ +//============================================================================= +// File : SMESH_NETGEN_3D.cxx +// Created : lundi 27 Janvier 2003 +// Author : Nadir BOUHAMOU (CEA) +// Project : SALOME +// Copyright : CEA 2003 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_NETGEN_3D.hxx" +#include "SMESH_MEFISTO_2D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_FacePosition.hxx" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "utilities.h" + +/* + Netgen include files +*/ + +#include "nglib.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NETGEN_3D::SMESH_NETGEN_3D(int hypId, int studyId, + SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_NETGEN_3D::SMESH_NETGEN_3D"); + _name = "NETGEN_3D"; +// _shapeType = TopAbs_SOLID; + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type +// MESSAGE("_shapeType octal " << oct << _shapeType); + _compatibleHypothesis.push_back("MaxElementVolume"); + + _maxElementVolume = 0.; + + _hypMaxElementVolume = NULL; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NETGEN_3D::~SMESH_NETGEN_3D() +{ + MESSAGE("SMESH_NETGEN_3D::~SMESH_NETGEN_3D"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_NETGEN_3D::CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_NETGEN_3D::CheckHypothesis"); + + _hypMaxElementVolume = NULL; + + list::const_iterator itl; + const SMESHDS_Hypothesis* theHyp; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (nbHyp != 1) return false; // only one compatible hypothesis allowed + + itl = hyps.begin(); + theHyp = (*itl); + + string hypName = theHyp->GetName(); + int hypId = theHyp->GetID(); + SCRUTE(hypName); + + bool isOk = false; + + if (hypName == "MaxElementVolume") + { + _hypMaxElementVolume = static_cast (theHyp); + ASSERT(_hypMaxElementVolume); + _maxElementVolume = _hypMaxElementVolume->GetMaxVolume(); + isOk =true; + } + + return isOk; +} + +//============================================================================= +/*! + *Here we are going to use the NETGEN mesher + */ +//============================================================================= + +bool SMESH_NETGEN_3D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_NETGEN_3D::Compute with maxElmentsize = " << _maxElementVolume); + + bool isOk = false; + SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + //const Handle(SMESHDS_SubMesh)& subMeshDS = theSubMesh->GetSubMeshDS(); + + map netgenToDS; + + MESSAGE("SMESH_NETGEN_3D::Compute Checking the mesh Faces"); + + // check if all faces were meshed by a triangle mesher (here MESFISTO_2D) + + vector meshFaces; + vector shapeFaces; + + for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) + { + TopoDS_Shape aShapeFace = exp.Current(); + SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); + ASSERT (aSubMesh); + int internal_size = meshFaces.size(); + int index = 0; + for (int i = 0;iGetSubShape(); + TopoDS_Shape aFace = shapeFaces[i]; + SMESH_Algo* algoFace = _gen->GetAlgo(aMesh, aShapeFace); + string algoFaceName = algoFace->GetName(); + SCRUTE(algoFaceName); + if (algoFaceName != "MEFISTO_2D") + { + SCRUTE(algoFaceName); + ASSERT(0); + return false; + } + + bool orientationMeshFace = (aFace.Orientation() == aShapeFace.Orientation()); + + const SMESHDS_SubMesh* aSubMeshDSFace = meshFaces[i]->GetSubMeshDS(); + SCRUTE(aSubMeshDSFace); + + int nbNodes = aSubMeshDSFace->NbNodes(); + NbTotOfNodesFaces += nbNodes; + int nbTria = aSubMeshDSFace->NbElements(); + NbTotOfTria += nbTria; + int index = 0; + + MESSAGE("SMESH_NETGEN_3D::Compute The mesh Face " << (i+1) << " has " << nbNodes << " face internal Nodes, " << nbTria << " triangles"); + + SCRUTE(orientationMeshFace); + + if (orientationMeshFace) + { + MESSAGE("The mesh and face have the same orientation"); + } + else + { + MESSAGE("The mesh and face have different orientations"); + } + + SMDS_Iterator * iteratorNodes = aSubMeshDSFace->GetNodes(); + SCRUTE(nbNodes); + index = 0; + while(iteratorNodes->more()) + { + index++; + const SMDS_MeshNode * node = iteratorNodes->next(); + int nodeId = node->GetID(); + double nodeX = node->X(); + double nodeY = node->Y(); + double nodeZ = node->Z(); + MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); + } + delete iteratorNodes; + + SCRUTE(index); + + SMDS_Iterator * iteratorTriangle = aSubMeshDSFace->GetElements(); + + SCRUTE(nbTria); + index = 0; + while(iteratorTriangle->more()) + { + index++; + const SMDS_MeshElement * triangle = iteratorTriangle->next(); + int triangleId = triangle->GetID(); + + SMDS_Iterator * triangleNodesIt = triangle->nodesIterator(); + + int triangleNode1 = (triangleNodesIt->next())->GetID(); + int triangleNode2 = (triangleNodesIt->next())->GetID(); + int triangleNode3 = (triangleNodesIt->next())->GetID(); + + MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3); + + } + delete iteratorTriangle; + + SCRUTE(index); + } + + SCRUTE(NbTotOfTria); + SCRUTE(NbTotOfNodesFaces); + + MESSAGE("SMESH_NETGEN_3D::Compute Checking the mesh Edges"); + + // check if all edges were meshed by a edge mesher (here Regular_1D) + + vector meshEdges; + for (TopExp_Explorer exp(aShape,TopAbs_EDGE);exp.More();exp.Next()) + { + SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); + ASSERT (aSubMesh); + int internal_size = meshEdges.size(); + int index = 0; + for (int i = 0;iGetSubShape(); + SMESH_Algo* algoEdge = _gen->GetAlgo(aMesh, aShapeEdge); + string algoEdgeName = algoEdge->GetName(); + SCRUTE(algoEdgeName); + if (algoEdgeName != "Regular_1D") + { + SCRUTE(algoEdgeName); + ASSERT(0); + return false; + } + + const SMESHDS_SubMesh* aSubMeshDSEdge = meshEdges[i]->GetSubMeshDS(); + SCRUTE(aSubMeshDSEdge); + + int nbNodes = aSubMeshDSEdge->NbNodes(); + NbTotOfNodesEdges += nbNodes; + int nbSegs = aSubMeshDSEdge->NbElements(); + NbTotOfSegs += nbSegs; + + MESSAGE("SMESH_NETGEN_3D::Compute The mesh Edge " << (i+1) << " has " << nbNodes << " edge internal Nodes, " << nbSegs << " segments"); + + SMDS_Iterator * iteratorNodes = aSubMeshDSEdge->GetNodes(); + SCRUTE(nbNodes); + int index = 0; + while(iteratorNodes->more()) + { + index++; + const SMDS_MeshNode * node = iteratorNodes->next(); + int nodeId = node->GetID(); + double nodeX = node->X(); + double nodeY = node->Y(); + double nodeZ = node->Z(); + MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); + } + delete iteratorNodes; + + SCRUTE(index); + } + + SCRUTE(NbTotOfNodesEdges); + SCRUTE(NbTotOfSegs); + + MESSAGE("SMESH_NETGEN_3D::Compute Checking the mesh Vertices"); + + vector meshVertices; + for (TopExp_Explorer exp(aShape,TopAbs_VERTEX);exp.More();exp.Next()) + { + SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); + ASSERT (aSubMesh); + int internal_size = meshVertices.size(); + int index = 0; + for (int i = 0;iGetSubShape(); + + const SMESHDS_SubMesh * aSubMeshDSVertex = meshVertices[i]->GetSubMeshDS(); + SCRUTE(aSubMeshDSVertex); + + int nbNodes = aSubMeshDSVertex->NbNodes(); + NbTotOfNodesVertices += nbNodes; + + MESSAGE("SMESH_NETGEN_3D::Compute The mesh Vertex " << (i+1) << " has " << nbNodes << " Nodes"); + + SMDS_Iterator * iteratorNodes = aSubMeshDSVertex->GetNodes(); + SCRUTE(nbNodes); + int index = 0; + while(iteratorNodes->more()) + { + index++; + const SMDS_MeshNode * node = iteratorNodes->next(); + int nodeId = node->GetID(); + double nodeX = node->X(); + double nodeY = node->Y(); + double nodeZ = node->Z(); + MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); + } + delete iteratorNodes; + + SCRUTE(index); + } + + SCRUTE(NbTotOfNodesVertices); + + MESSAGE("SMESH_NETGEN_3D::Compute --> Analysis of all shell mesh"); + + vector meshShells; + TopoDS_Shell aShell; + + for (TopExp_Explorer exp(aShape,TopAbs_SHELL);exp.More();exp.Next()) + { + SMESH_subMesh* aSubMesh = aMesh.GetSubMesh(exp.Current()); + ASSERT(aSubMesh); + SCRUTE(aSubMesh); + aShell = TopoDS::Shell(exp.Current()); + meshShells.push_back(aSubMesh); + } + + int numberOfShells = meshShells.size(); + SCRUTE(numberOfShells); + + if (numberOfShells == 1) + { + MESSAGE("SMESH_NETGEN_3D::Compute Only one shell --> generation of the mesh using directly Netgen"); + + /* + Prepare the Netgen surface mesh from the SMESHDS + */ + + MESSAGE("SMESH_NETGEN_3D::Compute Prepare the Netgen surface mesh from the SMESHDS"); + + int spaceDimension = 3; + int nbNodesByTri = 3; + int nbNodesByTetra = 4; + + int Netgen_NbOfNodes = NbTotOfNodesFaces + + NbTotOfNodesEdges + + NbTotOfNodesVertices; + int Netgen_NbOfTria = NbTotOfTria; + int Netgen_param2ndOrder = 0; + double Netgen_paramFine = 1.; + double Netgen_paramSize = _maxElementVolume; + + SCRUTE(Netgen_NbOfNodes); + SCRUTE(Netgen_NbOfTria); + + double * Netgen_Coordinates = new double [spaceDimension* + Netgen_NbOfNodes]; + int * listNodeCoresNetgenSmesh = new int [Netgen_NbOfNodes]; + int * Netgen_Connectivity = new int [nbNodesByTri*Netgen_NbOfTria]; + double * Netgen_point = new double [spaceDimension]; + int * Netgen_triangle = new int [nbNodesByTri]; + int * Netgen_tetrahedron = new int [nbNodesByTetra]; + + for (int i=0; iGetSubMeshDS(); + + SMDS_Iterator * iteratorNodes = aSubMeshDSVertex->GetNodes(); + + while(iteratorNodes->more()) + { + const SMDS_MeshNode * node = iteratorNodes->next(); + int nodeId = node->GetID(); + double nodeX = node->X(); + double nodeY = node->Y(); + double nodeZ = node->Z(); + MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); + listNodeCoresNetgenSmesh[indexNodes] = nodeId; + int index = indexNodes*spaceDimension; + Netgen_Coordinates[index] = nodeX; + Netgen_Coordinates[index+1] = nodeY; + Netgen_Coordinates[index+2] = nodeZ; + netgenToDS[indexNodes] = node; + indexNodes++; + } + delete iteratorNodes; + } + + for (int i=0; iGetSubMeshDS(); + + SMDS_Iterator * iteratorNodes = aSubMeshDSEdge->GetNodes(); + + while(iteratorNodes->more()) + { + const SMDS_MeshNode * node = iteratorNodes->next(); + int nodeId = node->GetID(); + double nodeX = node->X(); + double nodeY = node->Y(); + double nodeZ = node->Z(); + MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); + listNodeCoresNetgenSmesh[indexNodes] = node->GetID(); + int index = indexNodes*spaceDimension; + Netgen_Coordinates[index] = node->X(); + Netgen_Coordinates[index+1] = node->Y(); + Netgen_Coordinates[index+2] = node->Z(); + netgenToDS[indexNodes] = node; + indexNodes++; + } + delete iteratorNodes; + } + + for (int i=0; iGetSubMeshDS(); + + SMDS_Iterator * iteratorNodes = aSubMeshDSFace->GetNodes(); + + while(iteratorNodes->more()) + { + const SMDS_MeshNode * node = iteratorNodes->next(); + int nodeId = node->GetID(); + double nodeX = node->X(); + double nodeY = node->Y(); + double nodeZ = node->Z(); + MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); + listNodeCoresNetgenSmesh[indexNodes] = nodeId; + int index = indexNodes*spaceDimension; + Netgen_Coordinates[index] = nodeX; + Netgen_Coordinates[index+1] = nodeY; + Netgen_Coordinates[index+2] = nodeZ; + netgenToDS[indexNodes] = node; + indexNodes++; + } + delete iteratorNodes; + } + + SCRUTE(indexNodes); + + for (int i=0; iGetSubMeshDS(); + + TopoDS_Shape aFace = shapeFaces[i]; + + SMDS_Iterator * iteratorTriangle = aSubMeshDSFace->GetElements(); + + TopoDS_Shape aShapeFace = meshFaces[i]->GetSubShape(); + + bool orientationMeshFace = (aFace.Orientation() == aShapeFace.Orientation()); + + SCRUTE(orientationMeshFace); + + if (orientationMeshFace) + { + MESSAGE("The mesh and face have the same orientation"); + + while(iteratorTriangle->more()) + { + const SMDS_MeshElement * triangle = iteratorTriangle->next(); + int triangleId = triangle->GetID(); + + SMDS_Iterator * triangleNodesIt = triangle->nodesIterator(); + + int triangleNode1 = (triangleNodesIt->next())->GetID(); + int triangleNode2 = (triangleNodesIt->next())->GetID(); + int triangleNode3 = (triangleNodesIt->next())->GetID(); + + MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3); + + int N1New = 0; + int N2New = 0; + int N3New = 0; + int index = indexTrias*nbNodesByTri; + + for (int j=0; jmore()) + { + const SMDS_MeshElement * triangle = iteratorTriangle->next(); + int triangleId = triangle->GetID(); + + SMDS_Iterator * triangleNodesIt = triangle->nodesIterator(); + + int triangleNode1 = (triangleNodesIt->next())->GetID(); + int triangleNode3 = (triangleNodesIt->next())->GetID(); + int triangleNode2 = (triangleNodesIt->next())->GetID(); + + MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3); + + int N1New = 0; + int N2New = 0; + int N3New = 0; + int index = indexTrias*nbNodesByTri; + + for (int j=0; j=1) && (Nij<=Netgen_NbOfNodes)); + + nodesUsed[Nij-1] = 1; + Netgen_Connectivity[i*nbNodesByTri+j] = Nij; + } + + for (int i=0; i Adding the New Nodes to SMESHDS"); + + for (int i=0; iAddNode(Netgen_CoordinatesNew[index], + Netgen_CoordinatesNew[index+1], + Netgen_CoordinatesNew[index+2]); + + meshDS->SetNodeInVolume(node, aShell); + + index = i+Netgen_NbOfNodes; + netgenToDS[index] = node; + + listNodeShellCoresNetgenSmesh[i] = node->GetID(); + } + + SCRUTE(Netgen_NbOfNodesNew); + + SCRUTE(netgenToDS.size()); + + for (int i=0; i Adding the New elements (Tetrahedrons) to the SMESHDS"); + + for (int i=0; iAddVolume(node1,node2,node3,node4); + + meshDS->SetMeshElementOnShape(elt, aShell); + } + + /* + Free the memory needed by to generate the Netgen Mesh + */ + + MESSAGE("SMESH_NETGEN_3D::Compute Free the memory needed by to generate the Netgen Mesh"); + + delete [] Netgen_Coordinates; + delete [] Netgen_Connectivity; + delete [] Netgen_CoordinatesNew; + delete [] Netgen_ConnectivityNew; + delete [] Netgen_point; + delete [] Netgen_triangle; + delete [] Netgen_tetrahedron; + + delete [] listNodeCoresNetgenSmesh; + delete [] listNodeShellCoresNetgenSmesh; + + Ng_DeleteMesh(Netgen_mesh); + Ng_Exit(); + + /* + Verification + */ + + { + MESSAGE("SMESH_NETGEN_3D::Compute Verification of the Shell mesh"); + + TopoDS_Shape aShapeShell = meshShells[0]->GetSubShape(); + SMESH_Algo* algoShell = _gen->GetAlgo(aMesh, aShapeShell); + string algoShellName = algoShell->GetName(); + SCRUTE(algoShellName); + if (algoShellName != "NETGEN_3D") + { + SCRUTE(algoShellName); + ASSERT(0); + return false; + } + + const SMESHDS_SubMesh * aSubMeshDSShell = meshShells[0]->GetSubMeshDS(); + SCRUTE(&aSubMeshDSShell); + + int nbNodes = aSubMeshDSShell->NbNodes(); + int nbTetra = aSubMeshDSShell->NbElements(); + + MESSAGE("SMESH_NETGEN_3D::Compute The mesh Shell has " << nbNodes << " shell internal Nodes, " << nbTetra << " tetrahedrons"); + + SMDS_Iterator * iteratorNodes = aSubMeshDSShell->GetNodes(); + + SCRUTE(nbNodes); + + int index; + + index = 0; + + while(iteratorNodes->more()) + { + index++; + const SMDS_MeshNode * node = iteratorNodes->next(); + int nodeId = node->GetID(); + double nodeX = node->X(); + double nodeY = node->Y(); + double nodeZ = node->Z(); + MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); + } + delete iteratorNodes; + + SCRUTE(index); + + SMDS_Iterator * iteratorTetra = aSubMeshDSShell->GetElements(); + + SCRUTE(nbTetra); + + index = 0; + while(iteratorTetra->more()) + { + index++; + const SMDS_MeshElement * tetra = iteratorTetra->next(); + int tetraId = tetra->GetID(); + + SMDS_Iterator * tetraNodesIt = tetra->nodesIterator(); + + int tetraNode1 = (tetraNodesIt->next())->GetID(); + int tetraNode2 = (tetraNodesIt->next())->GetID(); + int tetraNode3 = (tetraNodesIt->next())->GetID(); + int tetraNode4 = (tetraNodesIt->next())->GetID(); + + MESSAGE("TETRAHEDRON -> ID = " << tetraId << " N1 = " << tetraNode1 << " N2 = " << tetraNode2 << " N3 = " << tetraNode3 << " N4 = " << tetraNode4); + + } + delete iteratorTetra; + + SCRUTE(index); + } + } + else + { + SCRUTE(numberOfShells); + MESSAGE("SMESH_NETGEN_3D::Compute ERROR More than one shell ????? "); + return false; + } + + return true; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_NETGEN_3D::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_NETGEN_3D::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_NETGEN_3D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_NETGEN_3D & hyp) +{ + return load; +} diff --git a/src/SMESH/SMESH_NETGEN_3D.hxx b/src/SMESH/SMESH_NETGEN_3D.hxx new file mode 100644 index 000000000..9606eb010 --- /dev/null +++ b/src/SMESH/SMESH_NETGEN_3D.hxx @@ -0,0 +1,42 @@ +//============================================================================= +// File : SMESH_NETGEN_3D.hxx +// Created : lundi 27 Janvier 2003 +// Author : Nadir BOUHAMOU (CEA) +// Project : SALOME +// Copyright : CEA 2003 +// $Header$ +//============================================================================= + +#ifndef _SMESH_NETGEN_3D_HXX_ +#define _SMESH_NETGEN_3D_HXX_ + +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_MaxElementVolume.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_NETGEN_3D: public SMESH_3D_Algo +{ +public: + SMESH_NETGEN_3D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_NETGEN_3D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_NETGEN_3D & hyp); + friend istream & operator >> (istream & load, SMESH_NETGEN_3D & hyp); + +protected: + double _maxElementVolume; + + const SMESH_MaxElementVolume* _hypMaxElementVolume; +}; + +#endif diff --git a/src/SMESH/SMESH_Tetra_3D.cxx b/src/SMESH/SMESH_Tetra_3D.cxx deleted file mode 100644 index addd168dd..000000000 --- a/src/SMESH/SMESH_Tetra_3D.cxx +++ /dev/null @@ -1,1027 +0,0 @@ -//============================================================================= -// File : SMESH_Tetra_3D.cxx -// Created : lundi 27 Janvier 2003 -// Author : Nadir BOUHAMOU (CEA) -// Project : SALOME -// Copyright : CEA 2003 -// $Header$ -//============================================================================= -using namespace std; - -#include "SMESH_Tetra_3D.hxx" -#include "SMESH_MEFISTO_2D.hxx" -#include "SMESH_Gen.hxx" -#include "SMESH_Mesh.hxx" - -#include "SMDS_MeshElement.hxx" -#include "SMDS_MeshNode.hxx" -#include "SMDS_FacePosition.hxx" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "utilities.h" - -/* - Netgen include files -*/ - -#include "nglib.h" - -//============================================================================= -/*! - * - */ -//============================================================================= - -SMESH_Tetra_3D::SMESH_Tetra_3D(int hypId, int studyId, - SMESH_Gen* gen) - : SMESH_3D_Algo(hypId, studyId, gen) -{ - MESSAGE("SMESH_Tetra_3D::SMESH_Tetra_3D"); - _name = "Tetra_3D"; -// _shapeType = TopAbs_SOLID; - _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type -// MESSAGE("_shapeType octal " << oct << _shapeType); - _compatibleHypothesis.push_back("MaxElementVolume"); - - _maxElementVolume = 0.; - - _hypMaxElementVolume = NULL; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -SMESH_Tetra_3D::~SMESH_Tetra_3D() -{ - MESSAGE("SMESH_Tetra_3D::~SMESH_Tetra_3D"); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -bool SMESH_Tetra_3D::CheckHypothesis(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape) -{ - MESSAGE("SMESH_Tetra_3D::CheckHypothesis"); - - _hypMaxElementVolume = NULL; - - list::const_iterator itl; - const SMESHDS_Hypothesis* theHyp; - - const list& hyps = GetUsedHypothesis(aMesh, aShape); - int nbHyp = hyps.size(); - if (nbHyp != 1) return false; // only one compatible hypothesis allowed - - itl = hyps.begin(); - theHyp = (*itl); - - string hypName = theHyp->GetName(); - int hypId = theHyp->GetID(); - SCRUTE(hypName); - - bool isOk = false; - - if (hypName == "MaxElementVolume") - { - _hypMaxElementVolume = static_cast (theHyp); - ASSERT(_hypMaxElementVolume); - _maxElementVolume = _hypMaxElementVolume->GetMaxVolume(); - isOk =true; - } - - return isOk; -} - -//============================================================================= -/*! - *Here we are going to use the NETGEN mesher - */ -//============================================================================= - -bool SMESH_Tetra_3D::Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape) - throw (SALOME_Exception) -{ - MESSAGE("SMESH_Tetra_3D::Compute with maxElmentsize = " << _maxElementVolume); - - bool isOk = false; - SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); - SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); - //const Handle(SMESHDS_SubMesh)& subMeshDS = theSubMesh->GetSubMeshDS(); - - map netgenToDS; - - MESSAGE("SMESH_Tetra_3D::Compute Checking the mesh Faces"); - - // check if all faces were meshed by a triangle mesher (here MESFISTO_2D) - - vector meshFaces; - vector shapeFaces; - - for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) - { - TopoDS_Shape aShapeFace = exp.Current(); - SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); - ASSERT (aSubMesh); - int internal_size = meshFaces.size(); - int index = 0; - for (int i = 0;iGetSubShape(); - TopoDS_Shape aFace = shapeFaces[i]; - SMESH_Algo* algoFace = _gen->GetAlgo(aMesh, aShapeFace); - string algoFaceName = algoFace->GetName(); - SCRUTE(algoFaceName); - if (algoFaceName != "MEFISTO_2D") - { - SCRUTE(algoFaceName); - ASSERT(0); - return false; - } - - bool orientationMeshFace = (aFace.Orientation() == aShapeFace.Orientation()); - - const SMESHDS_SubMesh* aSubMeshDSFace = meshFaces[i]->GetSubMeshDS(); - SCRUTE(aSubMeshDSFace); - - int nbNodes = aSubMeshDSFace->NbNodes(); - NbTotOfNodesFaces += nbNodes; - int nbTria = aSubMeshDSFace->NbElements(); - NbTotOfTria += nbTria; - int index = 0; - - MESSAGE("SMESH_Tetra_3D::Compute The mesh Face " << (i+1) << " has " << nbNodes << " face internal Nodes, " << nbTria << " triangles"); - - SCRUTE(orientationMeshFace); - - if (orientationMeshFace) - { - MESSAGE("The mesh and face have the same orientation"); - } - else - { - MESSAGE("The mesh and face have different orientations"); - } - - SMDS_Iterator * iteratorNodes = aSubMeshDSFace->GetNodes(); - SCRUTE(nbNodes); - index = 0; - while(iteratorNodes->more()) - { - index++; - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); - MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - } - delete iteratorNodes; - - SCRUTE(index); - - SMDS_Iterator * iteratorTriangle = aSubMeshDSFace->GetElements(); - - SCRUTE(nbTria); - index = 0; - while(iteratorTriangle->more()) - { - index++; - const SMDS_MeshElement * triangle = iteratorTriangle->next(); - int triangleId = triangle->GetID(); - - SMDS_Iterator * triangleNodesIt = triangle->nodesIterator(); - - int triangleNode1 = (triangleNodesIt->next())->GetID(); - int triangleNode2 = (triangleNodesIt->next())->GetID(); - int triangleNode3 = (triangleNodesIt->next())->GetID(); - - MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3); - - } - delete iteratorTriangle; - - SCRUTE(index); - } - - SCRUTE(NbTotOfTria); - SCRUTE(NbTotOfNodesFaces); - - MESSAGE("SMESH_Tetra_3D::Compute Checking the mesh Edges"); - - // check if all edges were meshed by a edge mesher (here Regular_1D) - - vector meshEdges; - for (TopExp_Explorer exp(aShape,TopAbs_EDGE);exp.More();exp.Next()) - { - SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); - ASSERT (aSubMesh); - int internal_size = meshEdges.size(); - int index = 0; - for (int i = 0;iGetSubShape(); - SMESH_Algo* algoEdge = _gen->GetAlgo(aMesh, aShapeEdge); - string algoEdgeName = algoEdge->GetName(); - SCRUTE(algoEdgeName); - if (algoEdgeName != "Regular_1D") - { - SCRUTE(algoEdgeName); - ASSERT(0); - return false; - } - - const SMESHDS_SubMesh* aSubMeshDSEdge = meshEdges[i]->GetSubMeshDS(); - SCRUTE(aSubMeshDSEdge); - - int nbNodes = aSubMeshDSEdge->NbNodes(); - NbTotOfNodesEdges += nbNodes; - int nbSegs = aSubMeshDSEdge->NbElements(); - NbTotOfSegs += nbSegs; - - MESSAGE("SMESH_Tetra_3D::Compute The mesh Edge " << (i+1) << " has " << nbNodes << " edge internal Nodes, " << nbSegs << " segments"); - - SMDS_Iterator * iteratorNodes = aSubMeshDSEdge->GetNodes(); - SCRUTE(nbNodes); - int index = 0; - while(iteratorNodes->more()) - { - index++; - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); - MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - } - delete iteratorNodes; - - SCRUTE(index); - } - - SCRUTE(NbTotOfNodesEdges); - SCRUTE(NbTotOfSegs); - - MESSAGE("SMESH_Tetra_3D::Compute Checking the mesh Vertices"); - - vector meshVertices; - for (TopExp_Explorer exp(aShape,TopAbs_VERTEX);exp.More();exp.Next()) - { - SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); - ASSERT (aSubMesh); - int internal_size = meshVertices.size(); - int index = 0; - for (int i = 0;iGetSubShape(); - - const SMESHDS_SubMesh * aSubMeshDSVertex = meshVertices[i]->GetSubMeshDS(); - SCRUTE(aSubMeshDSVertex); - - int nbNodes = aSubMeshDSVertex->NbNodes(); - NbTotOfNodesVertices += nbNodes; - - MESSAGE("SMESH_Tetra_3D::Compute The mesh Vertex " << (i+1) << " has " << nbNodes << " Nodes"); - - SMDS_Iterator * iteratorNodes = aSubMeshDSVertex->GetNodes(); - SCRUTE(nbNodes); - int index = 0; - while(iteratorNodes->more()) - { - index++; - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); - MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - } - delete iteratorNodes; - - SCRUTE(index); - } - - SCRUTE(NbTotOfNodesVertices); - - MESSAGE("SMESH_Tetra_3D::Compute --> Analysis of all shell mesh"); - - vector meshShells; - TopoDS_Shell aShell; - - for (TopExp_Explorer exp(aShape,TopAbs_SHELL);exp.More();exp.Next()) - { - SMESH_subMesh* aSubMesh = aMesh.GetSubMesh(exp.Current()); - ASSERT(aSubMesh); - SCRUTE(aSubMesh); - aShell = TopoDS::Shell(exp.Current()); - meshShells.push_back(aSubMesh); - } - - int numberOfShells = meshShells.size(); - SCRUTE(numberOfShells); - - if (numberOfShells == 1) - { - MESSAGE("SMESH_Tetra_3D::Compute Only one shell --> generation of the mesh using directly Netgen"); - - /* - Prepare the Netgen surface mesh from the SMESHDS - */ - - MESSAGE("SMESH_Tetra_3D::Compute Prepare the Netgen surface mesh from the SMESHDS"); - - int spaceDimension = 3; - int nbNodesByTri = 3; - int nbNodesByTetra = 4; - - int Netgen_NbOfNodes = NbTotOfNodesFaces + - NbTotOfNodesEdges + - NbTotOfNodesVertices; - int Netgen_NbOfTria = NbTotOfTria; - int Netgen_param2ndOrder = 0; - double Netgen_paramFine = 1.; - double Netgen_paramSize = _maxElementVolume; - - SCRUTE(Netgen_NbOfNodes); - SCRUTE(Netgen_NbOfTria); - - double * Netgen_Coordinates = new double [spaceDimension* - Netgen_NbOfNodes]; - int * listNodeCoresNetgenSmesh = new int [Netgen_NbOfNodes]; - int * Netgen_Connectivity = new int [nbNodesByTri*Netgen_NbOfTria]; - double * Netgen_point = new double [spaceDimension]; - int * Netgen_triangle = new int [nbNodesByTri]; - int * Netgen_tetrahedron = new int [nbNodesByTetra]; - - for (int i=0; iGetSubMeshDS(); - - SMDS_Iterator * iteratorNodes = aSubMeshDSVertex->GetNodes(); - - while(iteratorNodes->more()) - { - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); - MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - listNodeCoresNetgenSmesh[indexNodes] = nodeId; - int index = indexNodes*spaceDimension; - Netgen_Coordinates[index] = nodeX; - Netgen_Coordinates[index+1] = nodeY; - Netgen_Coordinates[index+2] = nodeZ; - netgenToDS[indexNodes] = node; - indexNodes++; - } - delete iteratorNodes; - } - - for (int i=0; iGetSubMeshDS(); - - SMDS_Iterator * iteratorNodes = aSubMeshDSEdge->GetNodes(); - - while(iteratorNodes->more()) - { - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); - MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - listNodeCoresNetgenSmesh[indexNodes] = node->GetID(); - int index = indexNodes*spaceDimension; - Netgen_Coordinates[index] = node->X(); - Netgen_Coordinates[index+1] = node->Y(); - Netgen_Coordinates[index+2] = node->Z(); - netgenToDS[indexNodes] = node; - indexNodes++; - } - delete iteratorNodes; - } - - for (int i=0; iGetSubMeshDS(); - - SMDS_Iterator * iteratorNodes = aSubMeshDSFace->GetNodes(); - - while(iteratorNodes->more()) - { - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); - MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - listNodeCoresNetgenSmesh[indexNodes] = nodeId; - int index = indexNodes*spaceDimension; - Netgen_Coordinates[index] = nodeX; - Netgen_Coordinates[index+1] = nodeY; - Netgen_Coordinates[index+2] = nodeZ; - netgenToDS[indexNodes] = node; - indexNodes++; - } - delete iteratorNodes; - } - - SCRUTE(indexNodes); - - for (int i=0; iGetSubMeshDS(); - - TopoDS_Shape aFace = shapeFaces[i]; - - SMDS_Iterator * iteratorTriangle = aSubMeshDSFace->GetElements(); - - TopoDS_Shape aShapeFace = meshFaces[i]->GetSubShape(); - - bool orientationMeshFace = (aFace.Orientation() == aShapeFace.Orientation()); - - SCRUTE(orientationMeshFace); - - if (orientationMeshFace) - { - MESSAGE("The mesh and face have the same orientation"); - - while(iteratorTriangle->more()) - { - const SMDS_MeshElement * triangle = iteratorTriangle->next(); - int triangleId = triangle->GetID(); - - SMDS_Iterator * triangleNodesIt = triangle->nodesIterator(); - - int triangleNode1 = (triangleNodesIt->next())->GetID(); - int triangleNode2 = (triangleNodesIt->next())->GetID(); - int triangleNode3 = (triangleNodesIt->next())->GetID(); - - MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3); - - int N1New = 0; - int N2New = 0; - int N3New = 0; - int index = indexTrias*nbNodesByTri; - - for (int j=0; jmore()) - { - const SMDS_MeshElement * triangle = iteratorTriangle->next(); - int triangleId = triangle->GetID(); - - SMDS_Iterator * triangleNodesIt = triangle->nodesIterator(); - - int triangleNode1 = (triangleNodesIt->next())->GetID(); - int triangleNode3 = (triangleNodesIt->next())->GetID(); - int triangleNode2 = (triangleNodesIt->next())->GetID(); - - MESSAGE("TRIANGLE -> ID = " << triangleId << " N1 = " << triangleNode1 << " N2 = " << triangleNode2 << " N3 = " << triangleNode3); - - int N1New = 0; - int N2New = 0; - int N3New = 0; - int index = indexTrias*nbNodesByTri; - - for (int j=0; j=1) && (Nij<=Netgen_NbOfNodes)); - - nodesUsed[Nij-1] = 1; - Netgen_Connectivity[i*nbNodesByTri+j] = Nij; - } - - for (int i=0; i Adding the New Nodes to SMESHDS"); - - for (int i=0; iAddNode(Netgen_CoordinatesNew[index], - Netgen_CoordinatesNew[index+1], - Netgen_CoordinatesNew[index+2]); - - meshDS->SetNodeInVolume(node, aShell); - - index = i+Netgen_NbOfNodes; - netgenToDS[index] = node; - - listNodeShellCoresNetgenSmesh[i] = node->GetID(); - } - - SCRUTE(Netgen_NbOfNodesNew); - - SCRUTE(netgenToDS.size()); - - for (int i=0; i Adding the New elements (Tetrahedrons) to the SMESHDS"); - - for (int i=0; iAddVolume(node1,node2,node3,node4); - - meshDS->SetMeshElementOnShape(elt, aShell); - } - - /* - Free the memory needed by to generate the Netgen Mesh - */ - - MESSAGE("SMESH_Tetra_3D::Compute Free the memory needed by to generate the Netgen Mesh"); - - delete [] Netgen_Coordinates; - delete [] Netgen_Connectivity; - delete [] Netgen_CoordinatesNew; - delete [] Netgen_ConnectivityNew; - delete [] Netgen_point; - delete [] Netgen_triangle; - delete [] Netgen_tetrahedron; - - delete [] listNodeCoresNetgenSmesh; - delete [] listNodeShellCoresNetgenSmesh; - - Ng_DeleteMesh(Netgen_mesh); - Ng_Exit(); - - /* - Verification - */ - - { - MESSAGE("SMESH_Tetra_3D::Compute Verification of the Shell mesh"); - - TopoDS_Shape aShapeShell = meshShells[0]->GetSubShape(); - SMESH_Algo* algoShell = _gen->GetAlgo(aMesh, aShapeShell); - string algoShellName = algoShell->GetName(); - SCRUTE(algoShellName); - if (algoShellName != "Tetra_3D") - { - SCRUTE(algoShellName); - ASSERT(0); - return false; - } - - const SMESHDS_SubMesh * aSubMeshDSShell = meshShells[0]->GetSubMeshDS(); - SCRUTE(&aSubMeshDSShell); - - int nbNodes = aSubMeshDSShell->NbNodes(); - int nbTetra = aSubMeshDSShell->NbElements(); - - MESSAGE("SMESH_Tetra_3D::Compute The mesh Shell has " << nbNodes << " shell internal Nodes, " << nbTetra << " tetrahedrons"); - - SMDS_Iterator * iteratorNodes = aSubMeshDSShell->GetNodes(); - - SCRUTE(nbNodes); - - int index; - - index = 0; - - while(iteratorNodes->more()) - { - index++; - const SMDS_MeshNode * node = iteratorNodes->next(); - int nodeId = node->GetID(); - double nodeX = node->X(); - double nodeY = node->Y(); - double nodeZ = node->Z(); - MESSAGE("NODE -> ID = " << nodeId << " X = " << nodeX << " Y = " << nodeY << " Z = " << nodeZ); - } - delete iteratorNodes; - - SCRUTE(index); - - SMDS_Iterator * iteratorTetra = aSubMeshDSShell->GetElements(); - - SCRUTE(nbTetra); - - index = 0; - while(iteratorTetra->more()) - { - index++; - const SMDS_MeshElement * tetra = iteratorTetra->next(); - int tetraId = tetra->GetID(); - - SMDS_Iterator * tetraNodesIt = tetra->nodesIterator(); - - int tetraNode1 = (tetraNodesIt->next())->GetID(); - int tetraNode2 = (tetraNodesIt->next())->GetID(); - int tetraNode3 = (tetraNodesIt->next())->GetID(); - int tetraNode4 = (tetraNodesIt->next())->GetID(); - - MESSAGE("TETRAHEDRON -> ID = " << tetraId << " N1 = " << tetraNode1 << " N2 = " << tetraNode2 << " N3 = " << tetraNode3 << " N4 = " << tetraNode4); - - } - delete iteratorTetra; - - SCRUTE(index); - } - } - else - { - SCRUTE(numberOfShells); - MESSAGE("SMESH_Tetra_3D::Compute ERROR More than one shell ????? "); - return false; - } - - return true; -} - - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & SMESH_Tetra_3D::SaveTo(ostream & save) -{ - return save << this; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & SMESH_Tetra_3D::LoadFrom(istream & load) -{ - return load >> (*this); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -ostream & operator << (ostream & save, SMESH_Tetra_3D & hyp) -{ - return save; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -istream & operator >> (istream & load, SMESH_Tetra_3D & hyp) -{ - return load; -} diff --git a/src/SMESH/SMESH_Tetra_3D.hxx b/src/SMESH/SMESH_Tetra_3D.hxx deleted file mode 100644 index ad7caf47f..000000000 --- a/src/SMESH/SMESH_Tetra_3D.hxx +++ /dev/null @@ -1,42 +0,0 @@ -//============================================================================= -// File : SMESH_Tetra_3D.hxx -// Created : lundi 27 Janvier 2003 -// Author : Nadir BOUHAMOU (CEA) -// Project : SALOME -// Copyright : CEA 2003 -// $Header$ -//============================================================================= - -#ifndef _SMESH_TETRA_3D_HXX_ -#define _SMESH_TETRA_3D_HXX_ - -#include "SMESH_3D_Algo.hxx" -#include "SMESH_Mesh.hxx" -#include "SMESH_MaxElementVolume.hxx" -#include "Utils_SALOME_Exception.hxx" - -class SMESH_Tetra_3D: public SMESH_3D_Algo -{ -public: - SMESH_Tetra_3D(int hypId, int studyId, SMESH_Gen* gen); - virtual ~SMESH_Tetra_3D(); - - virtual bool CheckHypothesis(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape); - - virtual bool Compute(SMESH_Mesh& aMesh, - const TopoDS_Shape& aShape) - throw (SALOME_Exception); - - ostream & SaveTo(ostream & save); - istream & LoadFrom(istream & load); - friend ostream & operator << (ostream & save, SMESH_Tetra_3D & hyp); - friend istream & operator >> (istream & load, SMESH_Tetra_3D & hyp); - -protected: - double _maxElementVolume; - - const SMESH_MaxElementVolume* _hypMaxElementVolume; -}; - -#endif diff --git a/src/SMESH_I/Makefile.in b/src/SMESH_I/Makefile.in index a1667387e..22bb4be76 100644 --- a/src/SMESH_I/Makefile.in +++ b/src/SMESH_I/Makefile.in @@ -79,7 +79,7 @@ CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lSMESHimpl -lSalomeContainer -lSalomeNS -lSalomeDS -lRegistry -lSalomeHDFPersist -lOpUtil -lGEOMClient -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverMED -lSalomeLifeCycleCORBA -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome ifeq (@WITHNETGEN@,yes) - LIB_SRC += SMESH_Tetra_3D_i.cxx + LIB_SRC += SMESH_NETGEN_3D_i.cxx LDFLAGS += -lNETGEN endif diff --git a/src/SMESH_I/SMESH_HypothesisFactory_i.cxx b/src/SMESH_I/SMESH_HypothesisFactory_i.cxx index c7bff6394..c05970d39 100644 --- a/src/SMESH_I/SMESH_HypothesisFactory_i.cxx +++ b/src/SMESH_I/SMESH_HypothesisFactory_i.cxx @@ -44,7 +44,7 @@ using namespace std; #include "SMESH_MEFISTO_2D_i.hxx" #include "SMESH_Quadrangle_2D_i.hxx" #include "SMESH_Hexa_3D_i.hxx" -#include "SMESH_Tetra_3D_i.hxx" +#include "SMESH_NETGEN_3D_i.hxx" //--------------------------------------- diff --git a/src/SMESH_I/SMESH_NETGEN_3D_i.cxx b/src/SMESH_I/SMESH_NETGEN_3D_i.cxx new file mode 100644 index 000000000..720ccefa5 --- /dev/null +++ b/src/SMESH_I/SMESH_NETGEN_3D_i.cxx @@ -0,0 +1,60 @@ +//============================================================================= +// File : SMESH_NETGEN_3D_i.cxx +// Created : Jeudi 31 Janvier 2003 +// Author : Nadir Bouhamou CEA +// Project : SALOME +// Copyright : CEA 2003 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_NETGEN_3D_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_HypothesisFactory.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NETGEN_3D_i::SMESH_NETGEN_3D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl) +{ + MESSAGE("SMESH_NETGEN_3D_i::SMESH_NETGEN_3D_i"); + _genImpl = genImpl; + ::SMESH_NETGEN_3D* impl + = new ::SMESH_NETGEN_3D(_genImpl->_hypothesisFactory.GetANewId(), + studyId, + genImpl); + SetImpl(impl); + _baseImpl = _impl; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NETGEN_3D_i::~SMESH_NETGEN_3D_i() +{ + MESSAGE("SMESH_NETGEN_3D_i::~SMESH_NETGEN_3D_i"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_NETGEN_3D_i::SetImpl(::SMESH_NETGEN_3D* impl) +{ + MESSAGE("SMESH_NETGEN_3D_i::SetImpl"); + SMESH_3D_Algo_i::SetImpl(impl); + _impl = impl; +} diff --git a/src/SMESH_I/SMESH_NETGEN_3D_i.hxx b/src/SMESH_I/SMESH_NETGEN_3D_i.hxx new file mode 100644 index 000000000..68f4dd789 --- /dev/null +++ b/src/SMESH_I/SMESH_NETGEN_3D_i.hxx @@ -0,0 +1,36 @@ +//============================================================================= +// File : SMESH_NETGEN_3D_i.hxx +// Created : Jeudi 31 Janvier 2003 +// Author : Nadir Bouhamou CEA +// Project : SALOME +// Copyright : CEA 2003 +// $Header$ +//============================================================================= +#ifndef _SMESH_NETGEN_3D_I_HXX_ +#define _SMESH_NETGEN_3D_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) + +#include "SMESH_3D_Algo_i.hxx" + +#include "SMESH_NETGEN_3D.hxx" + +class SMESH_NETGEN_3D_i: + public POA_SMESH::SMESH_NETGEN_3D, + public SMESH_3D_Algo_i +{ +public: + SMESH_NETGEN_3D_i(const char* anHyp, + int studyId, + ::SMESH_Gen* genImpl); + + virtual ~SMESH_NETGEN_3D_i(); + +protected: + virtual void SetImpl(::SMESH_NETGEN_3D* impl); + + ::SMESH_NETGEN_3D* _impl; +}; + +#endif diff --git a/src/SMESH_I/SMESH_Tetra_3D_i.cxx b/src/SMESH_I/SMESH_Tetra_3D_i.cxx deleted file mode 100644 index 9e1fa7594..000000000 --- a/src/SMESH_I/SMESH_Tetra_3D_i.cxx +++ /dev/null @@ -1,60 +0,0 @@ -//============================================================================= -// File : SMESH_Tetra_3D_i.cxx -// Created : Jeudi 31 Janvier 2003 -// Author : Nadir Bouhamou CEA -// Project : SALOME -// Copyright : CEA 2003 -// $Header$ -//============================================================================= -using namespace std; - -#include "SMESH_Tetra_3D_i.hxx" -#include "SMESH_Gen.hxx" -#include "SMESH_HypothesisFactory.hxx" - -#include "Utils_CorbaException.hxx" -#include "utilities.h" - -//============================================================================= -/*! - * - */ -//============================================================================= - -SMESH_Tetra_3D_i::SMESH_Tetra_3D_i(const char* anHyp, - int studyId, - ::SMESH_Gen* genImpl) -{ - MESSAGE("SMESH_Tetra_3D_i::SMESH_Tetra_3D_i"); - _genImpl = genImpl; - ::SMESH_Tetra_3D* impl - = new ::SMESH_Tetra_3D(_genImpl->_hypothesisFactory.GetANewId(), - studyId, - genImpl); - SetImpl(impl); - _baseImpl = _impl; -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -SMESH_Tetra_3D_i::~SMESH_Tetra_3D_i() -{ - MESSAGE("SMESH_Tetra_3D_i::~SMESH_Tetra_3D_i"); -} - -//============================================================================= -/*! - * - */ -//============================================================================= - -void SMESH_Tetra_3D_i::SetImpl(::SMESH_Tetra_3D* impl) -{ - MESSAGE("SMESH_Tetra_3D_i::SetImpl"); - SMESH_3D_Algo_i::SetImpl(impl); - _impl = impl; -} diff --git a/src/SMESH_I/SMESH_Tetra_3D_i.hxx b/src/SMESH_I/SMESH_Tetra_3D_i.hxx deleted file mode 100644 index 8a6259766..000000000 --- a/src/SMESH_I/SMESH_Tetra_3D_i.hxx +++ /dev/null @@ -1,36 +0,0 @@ -//============================================================================= -// File : SMESH_Tetra_3D_i.hxx -// Created : Jeudi 31 Janvier 2003 -// Author : Nadir Bouhamou CEA -// Project : SALOME -// Copyright : CEA 2003 -// $Header$ -//============================================================================= -#ifndef _SMESH_TETRA_3D_I_HXX_ -#define _SMESH_TETRA_3D_I_HXX_ - -#include -#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) - -#include "SMESH_3D_Algo_i.hxx" - -#include "SMESH_Tetra_3D.hxx" - -class SMESH_Tetra_3D_i: - public POA_SMESH::SMESH_Tetra_3D, - public SMESH_3D_Algo_i -{ -public: - SMESH_Tetra_3D_i(const char* anHyp, - int studyId, - ::SMESH_Gen* genImpl); - - virtual ~SMESH_Tetra_3D_i(); - -protected: - virtual void SetImpl(::SMESH_Tetra_3D* impl); - - ::SMESH_Tetra_3D* _impl; -}; - -#endif