--- /dev/null
+dnl Copyright (C) 2004-2012 CEA/DEN, EDF R&D
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+AC_DEFUN([CHECK_MESHGEMS_TETRA],[
+
+AC_CHECKING([for MeshGems-Tetra commercial product])
+
+MeshGems_Tetra_ok=no
+
+AC_EXEEXT
+AC_CHECK_PROG(MESHGEMS_TETRA, mg-tetra.exe$EXEEXT,found)
+
+if test "x$MESHGEMS_TETRA" == x ; then
+ AC_MSG_WARN(mg-tetra program not found in PATH variable)
+else
+ MeshGems_Tetra_ok=yes
+fi
+
+AC_MSG_RESULT(for MeshGems-Tetra: $MeshGems_Tetra_ok)
+
+])dnl
echo
echo ---------------------------------------------
-echo Testing GHS3D
+echo Testing MeshGems-Tetra
echo ---------------------------------------------
echo
-CHECK_GHS3D
-if test "${GHS3D_ok}" = "yes"; then
- if test "x$GHS3D_VERSION" = "x"
- then
- GHS3D_VERSION=`ghs3d -u |grep "TETMESH-GHS3D SOFTWARE"|awk '{print $3}'|awk -F- '{print $1}'|awk -F. '{print $1$2}'`
- fi
- AC_DEFINE_UNQUOTED(GHS3D_VERSION,${GHS3D_VERSION})
-fi
+CHECK_MESHGEMS_TETRA
echo
echo ---------------------------------------------
echo Configure
if test "${gui_ok}" = "yes"; then
- variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok Kernel_ok gui_ok Geom_ok Med_ok SMesh_ok GHS3D_ok OpenGL_ok qt_ok vtk_ok"
+ variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok Kernel_ok gui_ok Geom_ok Med_ok SMesh_ok MeshGems_Tetra_ok OpenGL_ok qt_ok vtk_ok"
elif test "${SalomeGUI_need}" != "no"; then
- variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok Kernel_ok gui_ok Geom_ok Med_ok SMesh_ok GHS3D_ok vtk_ok"
+ variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok Kernel_ok gui_ok Geom_ok Med_ok SMesh_ok MeshGems_Tetra_ok vtk_ok"
else
- variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok Kernel_ok Geom_ok Med_ok SMesh_ok GHS3D_ok vtk_ok"
+ variables="cc_ok boost_ok threads_ok omniORB_ok occ_ok doxygen_ok Kernel_ok Geom_ok Med_ok SMesh_ok MeshGems_Tetra_ok vtk_ok"
fi
for var in $variables
--- /dev/null
+# Copyright (C) 2012 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
+INCLUDE(${KERNEL_ROOT_DIR}/salome_adm/cmake_files/SalomeMacros.cmake)
+
+SET(top_builddir ${CMAKE_BINARY_DIR})
+SET(top_srcdir ${CMAKE_SOURCE_DIR})
+SET(srcdir ${CMAKE_CURRENT_SOURCE_DIR})
+SET(builddir ${CMAKE_CURRENT_BINARY_DIR})
+SET(datadir${CMAKE_INSTALL_PREFIX}/share)
+SET(docdir ${datadir}/doc/salome)
+SET(guidocdir ${docdir}/gui/GHS3DPLUGIN)
+
+SALOME_CONFIGURE_FILE(doxyfile.in doxyfile)
+SALOME_CONFIGURE_FILE(doxyfile_py.in doxyfile_py)
+SALOME_CONFIGURE_FILE(static/header.html.in ${builddir}/static/header.html)
+SALOME_CONFIGURE_FILE(static/header_py.html.in ${builddir}/static/header_py.html)
+
+SET(DOC_SMESH_MeshersList GHS3DPlugin)
+SET(f "$(SMESH_ROOT_DIR)/bin/salome/collect_mesh_methods.py")
+IF(WINDOWS)
+ STRING(REPLACE "/" "\\" f ${f})
+ STRING(REPLACE "/" "\\" SCR "@SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PYTHONPATH%
+ @SET PYTHONPATH=${OMNIORB_ROOT_USER}/lib/python\;%PYTHONPATH%
+ @SET PATH=${OMNIORB_ROOT_USER}/lib/x86_win32\;%PATH%
+ @SET PATH=$ENV{KERNEL_ROOT_DIR}/lib/salome\;%PATH%
+ @SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/bin/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=$ENV{KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=$ENV{MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=$ENV{MED_ROOT_DIR}/bin/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=$ENV{GEOM_ROOT_DIR}/bin/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=$ENV{SMESH_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=$ENV{SMESH_ROOT_DIR}/bin/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome\;%PYTHONPATH%
+ @SET PYTHONPATH=${CMAKE_INSTALL_PREFIX}/bin/salome\;%PYTHONPATH%
+ @SET SMESH_MeshersList=${DOC_SMESH_MeshersList}
+ ")
+ SET(EXT "bat")
+ SET(CALL_STR "call")
+ELSE(WINDOWS)
+ SET(DOC_PYTHONPATH ${CMAKE_INSTALL_PREFIX}/bin/salome:${SMESH_ROOT_DIR}/bin/salome:${SMESH_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages)
+ SET(SCR "export PYTHONPATH=${DOC_PYTHONPATH}:${PYTHONPATH}
+ export SMESH_MeshersList=${DOC_SMESH_MeshersList}
+ ")
+ SET(EXT "sh")
+ SET(CALL_STR ".")
+ENDIF(WINDOWS)
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} "${SCR}")
+
+ADD_CUSTOM_TARGET(usr_docs ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} && ${PYTHON_EXECUTABLE} ${f} -d -o smesh.py GHS3DPlugin
+ COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
+ COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
+ COMMAND ${PYTHON_EXECUTABLE} -c "import os; os.remove(r'''smesh.py'''); os.remove(r'''tmp_env.${EXT}''')"
+ COMMAND ${PYTHON_EXECUTABLE} -c "import shutil, sys; shutil.rmtree(r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/GHS3DPLUGIN''',True); shutil.copytree(r'''${CMAKE_CURRENT_BINARY_DIR}''',r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/GHS3DPLUGIN''', ignore=shutil.ignore_patterns('*usr_docs*', '*CMakeFiles*', '*.cmake', 'doxyfile*', '*.vcproj', 'static', 'Makefile*')); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''',r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/GHS3DPLUGIN'''); shutil.copy(r'''${CMAKE_CURRENT_SOURCE_DIR}/images/head.png''',r'''${CMAKE_INSTALL_PREFIX}/share/doc/salome/gui/GHS3DPLUGIN/ghs3dpluginpy_doc''')"
+ VERBATIM
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+)
GHS3DEnforcedMeshList GetEnforcedMeshes();
void ClearEnforcedMeshes();
+
/*!
* Set/get/unset an enforced vertex (private method for GUI)
*/
#include "SMESH_MeshEditor.hxx"
#include "SMESH_OctreeNode.hxx"
#include "SMESH_Group.hxx"
+#include <SMESH_subMeshEventListener.hxx>
+#include <SMESH_HypoFilter.hxx>
#include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx"
#define HOLE_ID -1
-#ifndef GHS3D_VERSION
-#define GHS3D_VERSION 41
-#endif
-
typedef const list<const SMDS_MeshFace*> TTriaList;
static void removeFile( const TCollection_AsciiString& fileName )
return meshDS->ShapeToIndex( solids(2) );
}
-//=======================================================================
-//function : countShape
-//purpose :
-//=======================================================================
-
+// //=======================================================================
+// //function : countShape
+// //purpose :
+// //=======================================================================
+//
// template < class Mesh, class Shape >
// static int countShape( Mesh* mesh, Shape shape ) {
// TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape );
// }
// return nbShape;
// }
-
-//=======================================================================
-//function : getShape
-//purpose :
-//=======================================================================
-
+//
+// //=======================================================================
+// //function : getShape
+// //purpose :
+// //=======================================================================
+//
// template < class Mesh, class Shape, class Tab >
// void getShape(Mesh* mesh, Shape shape, Tab *t_Shape) {
// TopExp_Explorer expShape ( mesh->ShapeToMesh(), shape );
// }
// return;
// }
-
-// //=======================================================================
-// //function : findEdgeID
-// //purpose :
-// //=======================================================================
+//
+// // //=======================================================================
+// // //function : findEdgeID
+// // //purpose :
+// // //=======================================================================
//
// static int findEdgeID(const SMDS_MeshNode* aNode,
// const SMESHDS_Mesh* theMesh,
// delete [] t_Dist;
// return theMesh->ShapeToIndex( foundEdge );
// }
-
-
-//=======================================================================
-//function : readGMFFile
-//purpose : read GMF file with geometry associated to mesh
-// TODO
-//=======================================================================
-
-// static bool readGMFFile(
-// const int fileOpen,
+//
+//
+// // =======================================================================
+// // function : readGMFFile
+// // purpose : read GMF file with geometry associated to mesh
+// // =======================================================================
+//
+// static bool readGMFFile(const int fileOpen,
// const char* theFileName,
// SMESH_Mesh& theMesh,
// const int nbShape,
//
//
// // The keyword does not exist yet => to update when it is created
-// // int nbTriangle = GmfStatKwd(InpMsh, GmfSubdomain);
+// // int nbSubdomains = GmfStatKwd(InpMsh, GmfSubdomain);
// // int id_tri[3];
//
//
// // case GmfHexahedra:
// {
// int nodeDim, shapeID, *nodeID;
-// SMDS_MeshNode** node;
+// const SMDS_MeshNode** node;
// // std::vector< SMDS_MeshNode* > enfNode( nbRef );
// SMDS_MeshElement * aGMFElement;
//
-// node = new SMDS_MeshNode*[nbRef];
+// node = new const SMDS_MeshNode*[nbRef];
// nodeID = new int[ nbRef ];
//
// for ( int iElem = 0; iElem < nbElem; iElem++ )
theMesh.GetMeshDS()->Modified();
return ok;
}
+
+namespace
+{
+ //================================================================================
+ /*!
+ * \brief Sub-mesh event listener setting enforced elements as soon as an enforced
+ * mesh is loaded
+ */
+ struct _EnforcedMeshRestorer : public SMESH_subMeshEventListener
+ {
+ _EnforcedMeshRestorer():
+ SMESH_subMeshEventListener( /*isDeletable = */true, Name() )
+ {}
+
+ //================================================================================
+ /*!
+ * \brief Returns an ID of listener
+ */
+ static const char* Name() { return "GHS3DPlugin_GHS3D::_EnforcedMeshRestorer"; }
+
+ //================================================================================
+ /*!
+ * \brief Treat events of the subMesh
+ */
+ void ProcessEvent(const int event,
+ const int eventType,
+ SMESH_subMesh* subMesh,
+ SMESH_subMeshEventListenerData* data,
+ const SMESH_Hypothesis* hyp)
+ {
+ if ( SMESH_subMesh::SUBMESH_LOADED == event &&
+ SMESH_subMesh::COMPUTE_EVENT == eventType &&
+ data &&
+ !data->mySubMeshes.empty() )
+ {
+ // An enforced mesh (subMesh->_father) has been loaded from hdf file
+ if ( GHS3DPlugin_Hypothesis* hyp = GetGHSHypothesis( data->mySubMeshes.front() ))
+ hyp->RestoreEnfElemsByMeshes();
+ }
+ }
+ //================================================================================
+ /*!
+ * \brief Returns GHS3DPlugin_Hypothesis used to compute a subMesh
+ */
+ static GHS3DPlugin_Hypothesis* GetGHSHypothesis( SMESH_subMesh* subMesh )
+ {
+ SMESH_HypoFilter ghsHypFilter( SMESH_HypoFilter::HasName( "GHS3D_Parameters" ));
+ return (GHS3DPlugin_Hypothesis* )
+ subMesh->GetFather()->GetHypothesis( subMesh->GetSubShape(),
+ ghsHypFilter,
+ /*visitAncestors=*/true);
+ }
+ };
+}
+
+//================================================================================
+/*!
+ * \brief Set an event listener to set enforced elements as soon as an enforced
+ * mesh is loaded
+ */
+//================================================================================
+
+void GHS3DPlugin_GHS3D::SubmeshRestored(SMESH_subMesh* subMesh)
+{
+ if ( GHS3DPlugin_Hypothesis* hyp = _EnforcedMeshRestorer::GetGHSHypothesis( subMesh ))
+ {
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList enfMeshes = hyp->_GetEnforcedMeshes();
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedMeshList::iterator it = enfMeshes.begin();
+ for(;it != enfMeshes.end();++it) {
+ GHS3DPlugin_Hypothesis::TGHS3DEnforcedMesh* enfMesh = *it;
+ if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
+ {
+ SMESH_subMesh* smToListen = mesh->GetSubMesh( mesh->GetShapeToMesh() );
+ // a listener set to smToListen will care of hypothesis stored in SMESH_EventListenerData
+ subMesh->SetEventListener( new _EnforcedMeshRestorer(),
+ SMESH_subMeshEventListenerData::MakeData( subMesh ),
+ smToListen);
+ }
+ }
+ }
+}
virtual bool Compute(SMESH_Mesh& theMesh,
SMESH_MesherHelper* aHelper);
+ virtual void SubmeshRestored(SMESH_subMesh* subMesh);
+
bool importGMFMesh(const char* aGMFFileName, SMESH_Mesh& aMesh);
private:
bool added = SetEnforcedElements( theElemSet, elementType, groupName);
if (added) {
TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
- newEnfMesh->name = name;
- newEnfMesh->entry = entry;
+ newEnfMesh->persistID = theMesh.GetMeshDS()->GetPersistentId();
+ newEnfMesh->name = name;
+ newEnfMesh->entry = entry;
newEnfMesh->elementType = elementType;
- newEnfMesh->groupName = groupName;
+ newEnfMesh->groupName = groupName;
TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
if (it == _enfMeshList.end()) {
_entryEnfMeshMap[entry].insert(newEnfMesh);
_enfMeshList.insert(newEnfMesh);
}
+ else {
+ delete newEnfMesh;
+ }
}
return added;
}
NotifySubMeshesHypothesisModification();
}
+//================================================================================
+/*!
+ * \brief At mesh loading, restore enforced elements by just loaded enforced meshes
+ */
+//================================================================================
+
+void GHS3DPlugin_Hypothesis::RestoreEnfElemsByMeshes()
+{
+ TGHS3DEnforcedMeshList::const_iterator it = _enfMeshList.begin();
+ for(;it != _enfMeshList.end();++it) {
+ TGHS3DEnforcedMesh* enfMesh = *it;
+ if ( SMESH_Mesh* mesh = GetMeshByPersistentID( enfMesh->persistID ))
+ SetEnforcedMesh( *mesh,
+ enfMesh->elementType,
+ enfMesh->name,
+ enfMesh->entry,
+ enfMesh->groupName );
+ enfMesh->persistID = -1; // not to restore again
+ }
+}
//=======================================================================
//function : SetGroupsToRemove
save << " " << enfMesh->groupName;
save << " " << "__END_GROUP__";
}
+ save << " " << "__PERSIST_ID__";
+ save << " " << enfMesh->persistID;
save << " " << "__END_ENF_MESH__";
std::cout << "Saving of enforced mesh " << enfMesh->name.c_str() << " done" << std::endl;
}
std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
{
- bool isOK = true;
- int i;
- double d;
-
- isOK = (load >> i);
- if (isOK)
- myToMeshHoles = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myMaximumMemory = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myInitialMemory = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myOptimizationLevel = i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> myWorkingDirectory);
- if (isOK) {
- if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
- myKeepFiles = false;
- myWorkingDirectory.clear();
- }
- else if ( myWorkingDirectory == "1" ) {
- myKeepFiles = true;
- myWorkingDirectory.clear();
- }
- }
- else
- load.clear(ios::badbit | load.rdstate());
-
- if ( !myWorkingDirectory.empty() ) {
- isOK = (load >> i);
- if (isOK)
- myKeepFiles = i;
- else
- load.clear(ios::badbit | load.rdstate());
- }
-
- isOK = (load >> i);
- if (isOK)
- myVerboseLevel = (short) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToCreateNewNodes = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToUseBoundaryRecoveryVersion = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToUseFemCorrection = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> i);
- if (isOK)
- myToRemoveCentralPoint = (bool) i;
- else
- load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> d);
+ bool isOK = true;
+ int i;
+ double d;
+
+ isOK = (load >> i);
+ if (isOK)
+ myToMeshHoles = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myMaximumMemory = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myInitialMemory = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myOptimizationLevel = i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> myWorkingDirectory);
+ if (isOK) {
+ if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
+ myKeepFiles = false;
+ myWorkingDirectory.clear();
+ }
+ else if ( myWorkingDirectory == "1" ) {
+ myKeepFiles = true;
+ myWorkingDirectory.clear();
+ }
+ }
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ if ( !myWorkingDirectory.empty() ) {
+ isOK = (load >> i);
if (isOK)
- myGradation = d;
+ myKeepFiles = i;
else
- load.clear(ios::badbit | load.rdstate());
-
- std::string separator;
- bool hasOptions = false;
- bool hasEnforcedVertices = false;
- bool hasEnforcedMeshes = false;
- isOK = (load >> separator);
-
- if (isOK) {
- if (separator == "__OPTIONS_BEGIN__")
- hasOptions = true;
- else if (separator == "__ENFORCED_VERTICES_BEGIN__")
- hasEnforcedVertices = true;
- else if (separator == "__ENFORCED_MESHES_BEGIN__")
- hasEnforcedMeshes = true;
- }
-
- if (hasOptions) {
- std::string txt;
- while (isOK) {
- isOK = (load >> txt);
- if (isOK) {
- if (txt == "__OPTIONS_END__") {
- if (!myTextOption.empty()) {
- // Remove last space
- myTextOption.erase(myTextOption.end()-1);
- }
- isOK = false;
- break;
- }
- myTextOption += txt;
- myTextOption += " ";
- }
- }
- }
-
- if (hasOptions) {
- isOK = (load >> separator);
- if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
- hasEnforcedVertices = true;
- if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
- hasEnforcedMeshes = true;
- }
+ load.clear(ios::badbit | load.rdstate());
+ }
+
+ isOK = (load >> i);
+ if (isOK)
+ myVerboseLevel = (short) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToCreateNewNodes = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToUseBoundaryRecoveryVersion = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToUseFemCorrection = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> i);
+ if (isOK)
+ myToRemoveCentralPoint = (bool) i;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ isOK = (load >> d);
+ if (isOK)
+ myGradation = d;
+ else
+ load.clear(ios::badbit | load.rdstate());
+
+ std::string separator;
+ bool hasOptions = false;
+ bool hasEnforcedVertices = false;
+ bool hasEnforcedMeshes = false;
+ isOK = (load >> separator);
+
+ if (isOK) {
+ if (separator == "__OPTIONS_BEGIN__")
+ hasOptions = true;
+ else if (separator == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertices = true;
+ else if (separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
+ }
+
+ if (hasOptions) {
+ std::string txt;
+ while (isOK) {
+ isOK = (load >> txt);
+ if (isOK) {
+ if (txt == "__OPTIONS_END__") {
+ if (!myTextOption.empty()) {
+ // Remove last space
+ myTextOption.erase(myTextOption.end()-1);
+ }
+ isOK = false;
+ break;
+ }
+ myTextOption += txt;
+ myTextOption += " ";
+ }
+ }
+ }
+
+ if (hasOptions) {
+ isOK = (load >> separator);
+ if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertices = true;
+ if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
+ }
if (hasEnforcedVertices) {
- std::string txt, name, entry, groupName;
- double size, coords[3];
- bool isCompound;
- bool hasCoords = false;
- isOK = (load >> txt); // __BEGIN_VERTEX__
- while (isOK) {
- if (txt == "__ENFORCED_VERTICES_END__")
- isOK = false;
-
- TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
- while (isOK) {
- isOK = (load >> txt);
- if (txt == "__END_VERTEX__") {
- enfVertex->name = name;
- enfVertex->geomEntry = entry;
- enfVertex->isCompound = isCompound;
- enfVertex->groupName = groupName;
- enfVertex->coords.clear();
- if (hasCoords)
- enfVertex->coords.assign(coords,coords+3);
-
- _enfVertexList.insert(enfVertex);
-
- if (enfVertex->coords.size())
- _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
- if (!enfVertex->geomEntry.empty())
- _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
-
- name.clear();
- entry.clear();
- groupName.clear();
- hasCoords = false;
- isOK = false;
- }
-
- if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
- while (isOK && (txt != "__END_NAME__")) {
- isOK = (load >> txt);
- if (txt != "__END_NAME__") {
- if (!name.empty())
- name += " ";
- name += txt;
- }
- }
- MESSAGE("name: " <<name);
- }
-
- if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
- isOK = (load >> entry);
- isOK = (load >> isCompound);
- isOK = (load >> txt); // __END_ENTRY__
- if (txt != "__END_ENTRY__")
- throw std::exception();
- MESSAGE("entry: " << entry);
- }
-
- if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
- while (isOK && (txt != "__END_GROUP__")) {
- isOK = (load >> txt);
- if (txt != "__END_GROUP__") {
- if (!groupName.empty())
- groupName += " ";
- groupName += txt;
- }
- }
- MESSAGE("groupName: " << groupName);
- }
-
- if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
- hasCoords = true;
- isOK = (load >> coords[0] >> coords[1] >> coords[2]);
- isOK = (load >> txt); // __END_COORDS__
- if (txt != "__END_COORDS__")
- throw std::exception();
- MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
- }
-
- if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__
- isOK = (load >> size);
- isOK = (load >> txt); // __END_ENTRY__
- if (txt != "__END_SIZE__") {
- throw std::exception();
- }
- MESSAGE("size: " << size);
- }
- }
- isOK = (load >> txt); // __BEGIN_VERTEX__
- }
+ std::string txt, name, entry, groupName;
+ double size, coords[3];
+ bool isCompound;
+ bool hasCoords = false;
+ isOK = (load >> txt); // __BEGIN_VERTEX__
+ while (isOK) {
+ if (txt == "__ENFORCED_VERTICES_END__")
+ isOK = false;
+
+ TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
+ while (isOK) {
+ isOK = (load >> txt);
+ if (txt == "__END_VERTEX__") {
+ enfVertex->name = name;
+ enfVertex->geomEntry = entry;
+ enfVertex->isCompound = isCompound;
+ enfVertex->groupName = groupName;
+ enfVertex->coords.clear();
+ if (hasCoords)
+ enfVertex->coords.assign(coords,coords+3);
+
+ _enfVertexList.insert(enfVertex);
+
+ if (enfVertex->coords.size())
+ _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
+ if (!enfVertex->geomEntry.empty())
+ _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
+
+ name.clear();
+ entry.clear();
+ groupName.clear();
+ hasCoords = false;
+ isOK = false;
+ }
+
+ if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
+ while (isOK && (txt != "__END_NAME__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_NAME__") {
+ if (!name.empty())
+ name += " ";
+ name += txt;
+ }
+ }
+ MESSAGE("name: " <<name);
+ }
+
+ if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
+ isOK = (load >> entry);
+ isOK = (load >> isCompound);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_ENTRY__")
+ throw std::exception();
+ MESSAGE("entry: " << entry);
+ }
+
+ if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
+ while (isOK && (txt != "__END_GROUP__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_GROUP__") {
+ if (!groupName.empty())
+ groupName += " ";
+ groupName += txt;
+ }
+ }
+ MESSAGE("groupName: " << groupName);
+ }
+
+ if (txt == "__BEGIN_COORDS__") { // __BEGIN_COORDS__
+ hasCoords = true;
+ isOK = (load >> coords[0] >> coords[1] >> coords[2]);
+ isOK = (load >> txt); // __END_COORDS__
+ if (txt != "__END_COORDS__")
+ throw std::exception();
+ MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
+ }
+
+ if (txt == "__BEGIN_SIZE__") { // __BEGIN_ENTRY__
+ isOK = (load >> size);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_SIZE__") {
+ throw std::exception();
+ }
+ MESSAGE("size: " << size);
+ }
+ }
+ isOK = (load >> txt); // __BEGIN_VERTEX__
+ }
}
if (hasEnforcedVertices) {
- isOK = (load >> separator);
- if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
- hasEnforcedMeshes = true;
+ isOK = (load >> separator);
+ if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
+ hasEnforcedMeshes = true;
}
if (hasEnforcedMeshes) {
- std::string txt, name, entry, groupName;
- int elementType = -1;
- isOK = (load >> txt); // __BEGIN_ENF_MESH__
- while (isOK) {
-// if (isOK) {
- if (txt == "__ENFORCED_MESHES_END__")
- isOK = false;
-
- TGHS3DEnforcedMesh *enfMesh = new TGHS3DEnforcedMesh();
- while (isOK) {
- isOK = (load >> txt);
- if (txt == "__END_ENF_MESH__") {
- enfMesh->name = name;
- enfMesh->entry = entry;
- enfMesh->elementType = (SMESH::ElementType)elementType;
- enfMesh->groupName = groupName;
-
- _enfMeshList.insert(enfMesh);
- std::cout << "Restoring of enforced mesh " <<name << " done" << std::endl;
-
- name.clear();
- entry.clear();
- elementType = -1;
- groupName.clear();
- isOK = false;
- }
-
- if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
- while (isOK && (txt != "__END_NAME__")) {
- isOK = (load >> txt);
- if (txt != "__END_NAME__") {
- if (!name.empty())
- name += " ";
- name += txt;
- }
- }
- MESSAGE("name: " <<name);
- }
-
- if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
- isOK = (load >> entry);
- isOK = (load >> txt); // __END_ENTRY__
- if (txt != "__END_ENTRY__")
- throw std::exception();
- MESSAGE("entry: " << entry);
- }
-
- if (txt == "__BEGIN_ELEM_TYPE__") { // __BEGIN_ELEM_TYPE__
- isOK = (load >> elementType);
- isOK = (load >> txt); // __END_ELEM_TYPE__
- if (txt != "__END_ELEM_TYPE__")
- throw std::exception();
- MESSAGE("elementType: " << elementType);
- }
-
- if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
- while (isOK && (txt != "__END_GROUP__")) {
- isOK = (load >> txt);
- if (txt != "__END_GROUP__") {
- if (!groupName.empty())
- groupName += " ";
- groupName += txt;
- }
- } // while
- MESSAGE("groupName: " << groupName);
- } // if
- std::cout << "isOK: " << isOK << std::endl;
- } // while
-// } // if
- isOK = (load >> txt); // __BEGIN_ENF_MESH__
- } // while
+ std::string txt, name, entry, groupName;
+ int elementType = -1, persistID = -1;
+ isOK = (load >> txt); // __BEGIN_ENF_MESH__
+ while (isOK) {
+ // if (isOK) {
+ if (txt == "__ENFORCED_MESHES_END__")
+ isOK = false;
+
+ TGHS3DEnforcedMesh *enfMesh = new TGHS3DEnforcedMesh();
+ while (isOK) {
+ isOK = (load >> txt);
+ if (txt == "__END_ENF_MESH__") {
+ enfMesh->name = name;
+ enfMesh->entry = entry;
+ enfMesh->elementType = (SMESH::ElementType)elementType;
+ enfMesh->groupName = groupName;
+ enfMesh->persistID = persistID;
+
+ _enfMeshList.insert(enfMesh);
+ std::cout << "Restoring of enforced mesh " <<name << " done" << std::endl;
+
+ name.clear();
+ entry.clear();
+ elementType = -1;
+ groupName.clear();
+ persistID = -1;
+ isOK = false;
+ }
+
+ if (txt == "__BEGIN_NAME__") { // __BEGIN_NAME__
+ while (isOK && (txt != "__END_NAME__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_NAME__") {
+ if (!name.empty())
+ name += " ";
+ name += txt;
+ }
+ }
+ MESSAGE("name: " <<name);
+ }
+
+ if (txt == "__BEGIN_ENTRY__") { // __BEGIN_ENTRY__
+ isOK = (load >> entry);
+ isOK = (load >> txt); // __END_ENTRY__
+ if (txt != "__END_ENTRY__")
+ throw std::exception();
+ MESSAGE("entry: " << entry);
+ }
+
+ if (txt == "__BEGIN_ELEM_TYPE__") { // __BEGIN_ELEM_TYPE__
+ isOK = (load >> elementType);
+ isOK = (load >> txt); // __END_ELEM_TYPE__
+ if (txt != "__END_ELEM_TYPE__")
+ throw std::exception();
+ MESSAGE("elementType: " << elementType);
+ }
+
+ if (txt == "__BEGIN_GROUP__") { // __BEGIN_GROUP__
+ while (isOK && (txt != "__END_GROUP__")) {
+ isOK = (load >> txt);
+ if (txt != "__END_GROUP__") {
+ if (!groupName.empty())
+ groupName += " ";
+ groupName += txt;
+ }
+ } // while
+ MESSAGE("groupName: " << groupName);
+ } // if
+
+ if (txt == "__PERSIST_ID__") {
+ isOK = (load >> persistID);
+ MESSAGE("persistID: " << persistID);
+ }
+ std::cout << "isOK: " << isOK << std::endl;
+ } // while
+ // } // if
+ isOK = (load >> txt); // __BEGIN_ENF_MESH__
+ } // while
} // if
return load;
const bool hasShapeToMesh)
{
TCollection_AsciiString cmd;
- if (hasShapeToMesh)
- cmd = "ghs3d-41"; // to use old mesh2 format
- else
- cmd = "ghs3d"; // to use new mesh format
+ cmd = "mg-tetra.exe";
// check if any option is overridden by hyp->myTextOption
bool m = hyp ? ( hyp->myTextOption.find("-m") == std::string::npos ) : true;
bool M = hyp ? ( hyp->myTextOption.find("-M") == std::string::npos ) : true;
////////////////////
struct TGHS3DEnforcedMesh {
+ int persistID;
std::string name;
std::string entry;
std::string groupName;
const TIDSortedElemGroupMap _GetEnforcedTriangles() const { return _enfTriangles; }
const TID2SizeMap _GetNodeIDToSizeMap() const {return _nodeIDToSizeMap; }
const TSetStrings _GetGroupsToRemove() const {return _groupsToRemove; }
+ void RestoreEnfElemsByMeshes(); // persistence
/*!
* \brief Return the enforced vertices
*/
// #include <SALOMEconfig.h>
// #include CORBA_SERVER_HEADER(SALOMEDS)
-#ifndef GHS3D_VERSION
-#define GHS3D_VERSION 41
-#endif
//=======================================================================
//function : GHS3DPlugin_Hypothesis_i
//=======================================================================
bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theGroupName)
throw (SALOME::SALOME_Exception)
{
-#if GHS3D_VERSION >= 42
+// #if GHS3D_VERSION >= 42
return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
-#else
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 719;
- throw SALOME::SALOME_Exception(ExDescription);
-#endif
+// #else
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 719;
+// throw SALOME::SALOME_Exception(ExDescription);
+// #endif
}
/*!
throw (SALOME::SALOME_Exception)
{
// MESSAGE("GHS3DPlugin_Hypothesis_i::SetEnforcedMesh");
-#if GHS3D_VERSION >= 42
+// #if GHS3D_VERSION >= 42
return p_SetEnforcedMesh(theSource, theType);
-#else
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 750;
- throw SALOME::SALOME_Exception(ExDescription);
-#endif
+// #else
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 750;
+// throw SALOME::SALOME_Exception(ExDescription);
+// #endif
}
/*!
bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
throw (SALOME::SALOME_Exception)
{
-#if GHS3D_VERSION >= 42
+// #if GHS3D_VERSION >= 42
return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
-#else
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 750;
- throw SALOME::SALOME_Exception(ExDescription);
-#endif
+// #else
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 750;
+// throw SALOME::SALOME_Exception(ExDescription);
+// #endif
}
/*!
bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
throw (SALOME::SALOME_Exception)
{
-#if GHS3D_VERSION >= 42
+// #if GHS3D_VERSION >= 42
return p_SetEnforcedMesh(theSource, theType);
-#else
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
- ExDescription.lineNumber = 750;
- throw SALOME::SALOME_Exception(ExDescription);
-#endif
+// #else
+// SALOME::ExceptionStruct ExDescription;
+// ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
+// ExDescription.type = SALOME::BAD_PARAM;
+// ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
+// ExDescription.lineNumber = 750;
+// throw SALOME::SALOME_Exception(ExDescription);
+// #endif
}
bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
GHS3DPlugin_Hypothesis_i.cxx
libGHS3DEngine_la_CPPFLAGS = \
- $(KERNEL_CXXFLAGS) \
- $(CAS_CPPFLAGS) \
- $(GEOM_CXXFLAGS) \
- $(MED_CXXFLAGS) \
- $(SMESH_CXXFLAGS) \
- $(VTK_INCLUDES) \
- $(BOOST_CPPFLAGS) \
- $(CORBA_CXXFLAGS) \
- $(CORBA_INCLUDES) \
- -I$(top_builddir)/idl
+ $(KERNEL_CXXFLAGS) \
+ $(CAS_CPPFLAGS) \
+ $(GEOM_CXXFLAGS) \
+ $(MED_CXXFLAGS) \
+ $(SMESH_CXXFLAGS) \
+ $(VTK_INCLUDES) \
+ $(BOOST_CPPFLAGS) \
+ $(CORBA_CXXFLAGS) \
+ $(CORBA_INCLUDES) \
+ -I$(top_builddir)/idl
libGHS3DEngine_la_LDFLAGS = \
../../idl/libSalomeIDLGHS3DPLUGIN.la \
// myEnfMesh = SMESH::SMESH_Mesh::_nil();
// myEnfMeshArray = new SMESH::mesh_array();
- myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
+ myEnfMeshWdg = new StdMeshersGUI_ObjectReferenceParamWdg( SMESH::IDSOURCE, myEnfMeshGroup, /*multiSel=*/true);
myEnfMeshWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_MESH"), "QLineEdit { color: grey }");
myEnfMeshWdg->AvoidSimultaneousSelection(myEnfVertexWdg);