.. centered::
*"Distribution of layers"* hypothesis
-*Distribution of layers* hypothesis allows using any of
+*Distribution of layers* hypothesis allows using most of
:ref:`1D Hypotheses <a1d_meshing_hypo_page>` to define
the distribution of mesh layers.
SMESH_Mesh Offset(in SMESH_IDSource theObject,
in double Value,
in boolean CopyGroups,
+ in boolean CopyElements,
in string MeshName,
out ListOfGroups Groups)
raises (SALOME::SALOME_Exception);
const double theValue,
SMESH_Mesh* theTgtMesh,
const bool theMakeGroups,
+ const bool theCopyElements,
const bool theFixSelfIntersection)
{
SMESHDS_Mesh* meshDS = GetMeshDS();
( SMESH_MeshAlgos::MakeOffset( eIt, *meshDS, theValue,
theFixSelfIntersection,
new2OldFaces, new2OldNodes ));
+ if ( offsetMesh->NbElements() == 0 )
+ return PGroupIDs(); // MakeOffset() failed
+
+
+ if ( theTgtMesh == myMesh && !theCopyElements )
+ {
+ // clear the source elements
+ if ( theElements.empty() ) eIt = meshDS->elementsIterator( SMDSAbs_Face );
+ else eIt = SMESHUtils::elemSetIterator( theElements );
+ while ( eIt->more() )
+ meshDS->RemoveFreeElement( eIt->next(), 0 );
+ }
offsetMesh->Modified();
offsetMesh->CompactMesh(); // make IDs start from 1
tgtNodes.resize( srcNodes.size() );
for ( inode = 0; inode < srcNodes.size(); ++inode )
tgtNodes[inode] = getNodeWithSameID( tgtMeshDS, srcNodes[inode] );
- if ( aroundElements && tgtEditor.GetMeshDS()->FindElement( tgtNodes,
+ if ( /*aroundElements && */tgtEditor.GetMeshDS()->FindElement( tgtNodes,
missType,
/*noMedium=*/false))
continue;
for ( size_t i = 0; i < missingBndElems.size(); ++i )
{
TConnectivity& nodes = missingBndElems[ i ];
- if ( aroundElements && tgtEditor.GetMeshDS()->FindElement( nodes,
+ if ( /*aroundElements && */tgtEditor.GetMeshDS()->FindElement( nodes,
missType,
/*noMedium=*/false))
continue;
const double theValue,
SMESH_Mesh* theTgtMesh,
const bool theMakeGroups,
+ const bool theCopyElements,
const bool theFixSelfIntersection);
// Make an offset mesh from a source 2D mesh
QStringList aParameters;
aParameters << SpinBox->text();
- int actionButton = ActionGroup->checkedId();
- bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
+ int actionButton = ActionGroup->checkedId();
+ bool copyElements = ( actionButton == COPY_ELEMS_BUTTON );
+ bool makeGroups = ( MakeGroupsCheck->isEnabled() && MakeGroupsCheck->isChecked() );
SMESH::ListOfGroups_var groups;
SMESH::SMESH_Mesh_var mesh;
QStringList anEntryList;
switch ( actionButton ) {
case MOVE_ELEMS_BUTTON:
+ makeGroups = true;
if ( CheckBoxMesh->isChecked() )
for ( int i = 0; i < myObjects.count(); i++ ) {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
myMeshes[i]->SetParameters( aParameters.join( ":" ).toLatin1().constData() );
- mesh = aMeshEditor->Offset( myObjects[i], offsetValue, true, "", groups.out() );
+ mesh = aMeshEditor->Offset( myObjects[i], offsetValue, makeGroups,
+ copyElements, "", groups.out() );
}
else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::FACE);
myMeshes[0]->SetParameters( aParameters.join( ":" ).toLatin1().constData() );
- mesh = aMeshEditor->Offset( src, offsetValue, true, "", groups.out() );
+ mesh = aMeshEditor->Offset( src, offsetValue, makeGroups,
+ copyElements, "", groups.out() );
}
break;
for ( int i = 0; i < myObjects.count(); i++ ) {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
- mesh = aMeshEditor->Offset( myObjects[i], offsetValue, makeGroups, "", groups.out() );
+ mesh = aMeshEditor->Offset( myObjects[i], offsetValue, makeGroups,
+ copyElements, "", groups.out() );
}
else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::FACE );
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
- mesh = aMeshEditor->Offset( src, offsetValue, makeGroups, "", groups.out() );
+ mesh = aMeshEditor->Offset( src, offsetValue, makeGroups,
+ copyElements, "", groups.out() );
}
break;
SMESH::UniqueMeshName( LineEditNewMesh->text().replace( "*", myObjectsNames[i] ));
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditor();
myMeshes[i]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
- mesh = aMeshEditor->Offset( myObjects[i], offsetValue, makeGroups,
+ mesh = aMeshEditor->Offset( myObjects[i], offsetValue, makeGroups, copyElements,
aName.toLatin1().data(), groups.out() );
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ))
anEntryList.append( aSObject->GetID().c_str() );
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::FACE );
- mesh = aMeshEditor->Offset( src, offsetValue, makeGroups,
+ mesh = aMeshEditor->Offset( src, offsetValue, makeGroups, copyElements,
LineEditNewMesh->text().toLatin1().data(), groups.out() );
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() );
for ( int i = 0; i < myObjects.count(); i++ )
{
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[i]->GetMeshEditPreviewer();
- mesh = aMeshEditor->Offset( myObjects[i], offsetValue, false, "", groups.out() );
+ mesh = aMeshEditor->Offset( myObjects[i], offsetValue, false, false, "", groups.out() );
aMeshPreviewStruct << aMeshEditor->GetPreviewData();
}
else
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
SMESH::IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::FACE);
- mesh = aMeshEditor->Offset( src, offsetValue, false, "", groups.out() );
+ mesh = aMeshEditor->Offset( src, offsetValue, false, false, "", groups.out() );
aMeshPreviewStruct << aMeshEditor->GetPreviewData();
}
setSimulationPreview(aMeshPreviewStruct);
dot *= -1;
if ( dot * theSign < 0 )
{
- useOneNormal = true;
- // gp_XYZ p1 = oldXYZ + faces[ i ].Norm() * theOffset;
- // gp_XYZ p2 = oldXYZ + faces[ iPrev ].Norm() * theOffset;
- // useOneNormal = ( p1 - p2 ).SquareModulus() > theTol * theTol;
+ gp_XYZ p1 = oldXYZ + faces[ i ].Norm() * theOffset;
+ gp_XYZ p2 = oldXYZ + faces[ iPrev ].Norm() * theOffset;
+ useOneNormal = ( p1 - p2 ).SquareModulus() > 1e-12;
}
}
if ( useOneNormal && theNewNode->isMarked() )
SMESH::SMESH_Mesh_ptr SMESH_MeshEditor_i::Offset( SMESH::SMESH_IDSource_ptr theObject,
CORBA::Double theValue,
CORBA::Boolean theCopyGroups,
+ CORBA::Boolean theCopyElements,
const char* theMeshName,
SMESH::ListOfGroups_out theGroups)
throw (SALOME::SALOME_Exception)
TPreviewMesh * tmpMesh = getPreviewMesh();
tgtMesh = tmpMesh;
tmpMesh->Copy( elements, copyElements );
+ elements.swap( copyElements );
theCopyGroups = false;
+ theCopyElements = false;
}
else
{
SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh_var );
tgtMesh = & mesh_i->GetImpl();
}
- groupIds = getEditor().Offset( elements, theValue, tgtMesh, theCopyGroups, !myIsPreviewMode );
+ groupIds = getEditor().Offset( elements, theValue, tgtMesh,
+ theCopyGroups, theCopyElements, !myIsPreviewMode );
tgtMesh->GetMeshDS()->Modified();
}
if ( myIsPreviewMode )
{
- getPreviewMesh()->Remove( SMESHUtils::elemSetIterator( copyElements ));
+ //getPreviewMesh()->Remove( SMESHUtils::elemSetIterator( copyElements ));
}
else
{
theGroups = theCopyGroups ? getGroups( groupIds.get() ) : new SMESH::ListOfGroups;
+ if ( *theMeshName && mesh_var->NbFaces() == 0 )
+ {
+ // new mesh empty, remove it
+ SMESH_Gen_i* smesh = SMESH_Gen_i::GetSMESHGen();
+ SALOMEDS::Study_var study = smesh->GetCurrentStudy();
+ SALOMEDS::StudyBuilder_var builder = study->NewBuilder();
+ SALOMEDS::SObject_wrap meshSO = smesh->ObjectToSObject( study, mesh_var );
+ builder->RemoveObjectWithChildren( meshSO );
+ THROW_SALOME_CORBA_EXCEPTION("Offset failed", SALOME::INTERNAL_ERROR);
+ }
+
// result of Offset() is a tuple (mesh, groups)
if ( mesh_var->_is_nil() ) pyDump << myMesh_i->_this() << ", ";
else pyDump << mesh_var << ", ";
- pyDump << theGroups << " = "
- << this << ".Offset( "
+ pyDump << theGroups << " = " << this << ".Offset( "
+ << theObject << ", "
<< theValue << ", "
<< theCopyGroups << ", "
+ << theCopyElements << ", "
<< "'" << theMeshName<< "')";
}
SMESH::SMESH_Mesh_ptr Offset( SMESH::SMESH_IDSource_ptr theObject,
CORBA::Double Value,
CORBA::Boolean CopyGroups,
+ CORBA::Boolean CopyElements,
const char* MeshName,
SMESH::ListOfGroups_out Groups)
throw (SALOME::SALOME_Exception);
class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
"""
- Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism" depending on geometry
+ Defines a Prism 3D algorithm, which is either "Extrusion 3D" or "Radial Prism" depending on geometry.
It is created by calling smeshBuilder.Mesh.Prism(geom=0)
"""
class StdMeshersBuilder_RadialPrism3D(StdMeshersBuilder_Prism3D):
"""
- Defines Radial Prism 3D algorithm
- It is created by calling smeshBuilder.Mesh.Prism(geom=0)
+ Defines Radial Prism 3D algorithm.
+ It is created by calling smeshBuilder.Mesh.Prism(geom=0).
+ See :class:`StdMeshersBuilder_Prism3D` for methods defining distribution of mesh layers
+ build between the inner and outer shells.
"""
-
meshMethod = "Prism"
"""