//=============================================================================
//
#include "GHS3DPlugin_Hypothesis.hxx"
+#include <SMESH_ProxyMesh.hxx>
+#include <StdMeshers_QuadToTriaAdaptor.hxx>
#include <TCollection_AsciiString.hxx>
NotifySubMeshesHypothesisModification();
}
+
+//=======================================================================
+//function : SetEnforcedMesh
+//=======================================================================
+void GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, double size)
+{
+ TIDSortedElemSet theElemSet;
+ SMDS_ElemIteratorPtr eIt;
+
+ if ((elementType == SMESH::FACE) && (theMesh.NbQuadrangles() > 0)) {
+ SMESH_ProxyMesh::Ptr proxyMesh( new SMESH_ProxyMesh( theMesh ));
+
+ StdMeshers_QuadToTriaAdaptor* aQuad2Trias = new StdMeshers_QuadToTriaAdaptor;
+ aQuad2Trias->Compute( theMesh );
+ proxyMesh.reset(aQuad2Trias );
+
+// std::cout << "proxyMesh->NbFaces(): " << proxyMesh->NbFaces() << std::endl;
+// eIt = proxyMesh->GetFaces();
+// if (eIt)
+// while ( eIt->more() )
+// theElemSet.insert( eIt->next() );
+// else {
+// std::cout << "********************** eIt == 0 *****************" << std::endl;
+ eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
+ while ( eIt->more() ) {
+ const SMDS_MeshElement* elem = eIt->next();
+ theElemSet.insert( elem );
+ }
+ }
+
+ else
+ {
+ eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
+ while ( eIt->more() )
+ theElemSet.insert( eIt->next() );
+ }
+
+ MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source mesh");
+
+ SetEnforcedElements( theElemSet, elementType, size);
+
+}
+
//=======================================================================
//function : SetEnforcedElements
//=======================================================================
#include "SMESH_Gen.hxx"
#include "SMESH_PythonDump.hxx"
+//#include "SMESH_Mesh.hxx"
+//#include "SMESH_ProxyMesh.hxx"
+//#include <StdMeshers_QuadToTriaAdaptor.hxx>
#include "Utils_CorbaException.hxx"
#include "utilities.h"
if (theMesh_i)
{
- SMESH::long_array_var anIDs = theMesh_i->GetElementsByType(theType);
- if ( anIDs->length() == 0 ){MESSAGE("The source mesh is empty");}
- for (int i=0; i<anIDs->length(); i++) {
- CORBA::Long ind = anIDs[i];
- const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
- if (elem)
- theElemSet.insert( elem );
+ try {
+ this->GetImpl()->SetEnforcedMesh(anImplPtr->GetImpl(), theType, theSize);
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis::_SetEnforcedMesh(theSource, theType, theSize)";
+ ExDescription.lineNumber = 502;
+ throw SALOME::SALOME_Exception(ExDescription);
}
- MESSAGE("Add "<<theElemSet.size()<<" types["<<theType<<"] from source mesh");
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+//
+// SMESH::long_array_var anIDs = theMesh_i->GetElementsByType(theType);
+// if ( anIDs->length() == 0 ){MESSAGE("The source mesh is empty");}
+// for (int i=0; i<anIDs->length(); i++) {
+// CORBA::Long ind = anIDs[i];
+// const SMDS_MeshElement * elem = theMeshDS->FindElement(ind);
+// if (elem)
+// theElemSet.insert( elem );
+// }
+//// }
+// MESSAGE("Add "<<theElemSet.size()<<" types["<<theType<<"] from source mesh");
}
else if (theGroup_i && types->length() == 1 && types[0] == theType)
{
}
}
MESSAGE("Add "<<theElemSet.size()<<" types["<<theType<<"] from source group "<< theGroup_i->GetName());
- }
-
- try {
- this->GetImpl()->SetEnforcedElements(theElemSet, theType, theSize);
- }
- catch (const std::invalid_argument& ex) {
- SALOME::ExceptionStruct ExDescription;
- ExDescription.text = ex.what();
- ExDescription.type = SALOME::BAD_PARAM;
- ExDescription.sourceFile = "GHS3DPlugin_Hypothesis::_SetEnforcedMesh(theSource, theType, theSize)";
- ExDescription.lineNumber = 502;
- throw SALOME::SALOME_Exception(ExDescription);
- }
- catch (SALOME_Exception& ex) {
- THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+
+ try {
+ this->GetImpl()->SetEnforcedElements(theElemSet, theType, theSize);
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "GHS3DPlugin_Hypothesis::_SetEnforcedMesh(theSource, theType, theSize)";
+ ExDescription.lineNumber = 502;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
}
}
//=============================================================================