\page about_meshes_page About meshes
\n \b MESH represents a discrete approximation of a subset of the
-three-dimensional space by \ref mesh_entities "elementary geometrical elements".
+three-dimensional space by \ref mesh_entities "elementary geometrical
+elements".
+
+A SALOME study can contain multiple meshes, but they do not
+implicitly compose one super-mesh, and finally each of them
+can be used (e.g. exported) only individually.
Mesh module provides several ways to create the mesh:
<ul>
SEW_DIFF_NB_OF_ELEMENTS,
SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
SEW_BAD_SIDE1_NODES,
- SEW_BAD_SIDE2_NODES
- };
+ SEW_BAD_SIDE2_NODES,
+ SEW_INTERNAL_ERROR
+ };
Sew_Error SewFreeBorders (in long FirstNodeID1,
in long SecondNodeID1,
const SMDS_MeshElement* aElement = myMesh->FindElement(aRec.ElementList[i]);
if (aElement) {
switch (aElement->GetType()) {
+
case SMDSAbs_Edge:
if (!aEdgesGroup) {
aEdgesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Edge);
}
aEdgesGroup->Add(aElement);
break;
+
case SMDSAbs_Face:
if (!aFacesGroup) {
aFacesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Face);
}
aFacesGroup->Add(aElement);
break;
+
case SMDSAbs_Volume:
if (!aVolumeGroup) {
aVolumeGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Volume);
}
aVolumeGroup->Add(aElement);
break;
+
+ default:;
}
}
}
my0DActor->SetRepresentation(aReperesent);
myBallActor->SetRepresentation(aReperesent);
- switch(myControlMode){
+ switch ( myControlMode ) {
case eLength:
case eMultiConnection:
aProp = aBackProp = my1DProp;
if(myRepresentation != ePoint)
aReperesent = SMESH_DeviceActor::eInsideframe;
break;
+ default:;
}
if(aQuadraticMode == SMESH_Actor::eLines)
SMESH_ActorDef::
GetClippingPlane(vtkIdType theID)
{
- if(theID >= myCippingPlaneCont.size())
+ if ( theID >= (vtkIdType)myCippingPlaneCont.size() )
return NULL;
return myCippingPlaneCont[theID].Get();
}
bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
- for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
+ for ( size_t i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast<double>(nbEvents[i]));
if(funValues.size() >= 2)
enum LabelFont {
FntArial, //!< arial font family
FntCourier, //!< courier font family
- FntTimes, //!< times font family
+ FntTimes //!< times font family
};
SMESHOBJECT_EXPORT
vtkIdType SMESH_ExtractGeometry::GetElemObjId(int theVtkID)
{
- if( theVtkID < 0 || theVtkID >= myElemVTK2ObjIds.size()) return -1;
+ if( theVtkID < 0 || theVtkID >= (int)myElemVTK2ObjIds.size()) return -1;
return myElemVTK2ObjIds[theVtkID];
}
vtkIdType SMESH_ExtractGeometry::GetNodeObjId(int theVtkID)
{
- if ( theVtkID < 0 || theVtkID >= myNodeVTK2ObjIds.size()) return -1;
+ if ( theVtkID < 0 || theVtkID >= (int)myNodeVTK2ObjIds.size()) return -1;
return myNodeVTK2ObjIds[theVtkID];
}
// rnv begin
// Customization of the vtkScalarBarActor to show distribution histogram.
- bool distrVisibility = (numColors == this->myNbValues.size());
+ bool distrVisibility = (numColors == (int)this->myNbValues.size());
vtkPoints *distrPts;
vtkCellArray *distrPolys;
vtkUnsignedCharArray *distColors = 0;
if(!distrVisibility)
vtkDebugMacro(<<" Distribution invisible, because numColors == this->myNbValues.size()");
- if (distrVisibility && GetDistributionVisibility()) {
- for( i=0 ;i<myNbValues.size();i++ ) {
- if(myNbValues[i]) {
+ if ( distrVisibility && GetDistributionVisibility() ) {
+ for ( i = 0 ; i < (int)myNbValues.size(); i++ ) {
+ if ( myNbValues[i] ) {
numPositiveVal++;
maxValue = std::max(maxValue,myNbValues[i]);
- }
+ }
}
numDistrPts = 4*(numPositiveVal);
distrPts = vtkPoints::New();
int targetWidth, targetHeight;
// rnv begin
// Customization of the vtkScalarBarActor to show distribution histogram.
- bool distrVisibility = this->MaximumNumberOfColors == this->myNbValues.size();
+ bool distrVisibility = ( this->MaximumNumberOfColors == (int) this->myNbValues.size() );
double coef;
if( GetDistributionVisibility() && distrVisibility )
if(this->Orientation == VTK_ORIENT_VERTICAL)
}
//----------------------------------------------------------------------------
-void SMESH_ScalarBarActor::SizeTitle(int *titleSize,
- int *size,
- vtkViewport *viewport)
+void SMESH_ScalarBarActor::SizeTitle(int *titleSize,
+ int *size,
+ vtkViewport *viewport)
{
titleSize[0] = titleSize[1] = 0;
if (this->Title == NULL || !strlen(this->Title))
- {
+ {
return;
- }
+ }
int targetWidth, targetHeight;
-
+
targetWidth = size[0];
// rnv begin
// Customization of the vtkScalarBarActor to show distribution histogram.
- bool distrVisibility = this->MaximumNumberOfColors == this->myNbValues.size();
+ bool distrVisibility = ( this->MaximumNumberOfColors == (int) this->myNbValues.size() );
double coef;
- if( GetDistributionVisibility() && distrVisibility )
+ if ( GetDistributionVisibility() && distrVisibility )
coef=0.18;
- else
+ else
coef=0.25;
if ( this->Orientation == VTK_ORIENT_VERTICAL )
- {
- targetHeight = (int)(0.1*size[1]);
- }
+ {
+ targetHeight = (int)(0.1*size[1]);
+ }
else
- {
- targetHeight = (int)(coef*size[1]);
- }
+ {
+ targetHeight = (int)(coef*size[1]);
+ }
- this->TitleMapper->SetConstrainedFontSize(
- viewport, targetWidth, targetHeight);
+ this->TitleMapper->SetConstrainedFontSize(viewport, targetWidth, targetHeight);
this->TitleMapper->GetSize(viewport, titleSize);
}
*/
void SMDS_Down1D::allocate(int nbElems)
{
- if (nbElems >= _vtkCellIds.size())
- {
- _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
- _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
- _upCellIdsVector.resize(nbElems + SMDS_Mesh::chunkSize);
- _upCellTypesVector.resize(nbElems + SMDS_Mesh::chunkSize);
- }
+ if (nbElems >= (int)_vtkCellIds.size())
+ {
+ _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
+ _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _upCellIdsVector.resize(nbElems + SMDS_Mesh::chunkSize);
+ _upCellTypesVector.resize(nbElems + SMDS_Mesh::chunkSize);
+ }
}
void SMDS_Down1D::compactStorage()
_upCellIndex.resize(_maxId + 1, -1); // id and types of rank i correspond to [ _upCellIndex[i], _upCellIndex[i+1] [
int current = 0;
for (int i = 0; i < _maxId; i++)
+ {
+ _upCellIndex[i] = current;
+ for (size_t j = 0; j < _upCellIdsVector[i].size(); j++)
{
- _upCellIndex[i] = current;
- for (int j = 0; j < _upCellIdsVector[i].size(); j++)
- {
- _upCellIds[current] = _upCellIdsVector[i][j];
- _upCellTypes[current] = _upCellTypesVector[i][j];
- current++;
- }
+ _upCellIds[current] = _upCellIdsVector[i][j];
+ _upCellTypes[current] = _upCellTypesVector[i][j];
+ current++;
}
+ }
_upCellIndex[_maxId] = current;
_upCellIdsVector.clear();
*/
void SMDS_Down2D::allocate(int nbElems)
{
- if (nbElems >= _vtkCellIds.size())
- {
- _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
- _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
- _upCellIds.resize(2 * (nbElems + SMDS_Mesh::chunkSize), -1);
- _upCellTypes.resize(2 * (nbElems + SMDS_Mesh::chunkSize), -1);
- _tempNodes.resize(_nbNodes * (nbElems + SMDS_Mesh::chunkSize), -1);
- }
+ if (nbElems >= (int)_vtkCellIds.size())
+ {
+ _cellIds.resize (_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _vtkCellIds.resize (nbElems + SMDS_Mesh::chunkSize, -1);
+ _upCellIds.resize (2 * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _upCellTypes.resize(2 * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _tempNodes.resize (_nbNodes * (nbElems + SMDS_Mesh::chunkSize), -1);
+ }
}
void SMDS_Down2D::compactStorage()
void SMDS_Down3D::allocate(int nbElems)
{
- if (nbElems >= _vtkCellIds.size())
- {
- _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
- _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
- }
+ if (nbElems >= (int)_vtkCellIds.size())
+ {
+ _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
+ }
}
void SMDS_Down3D::compactStorage()
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
set<int> tofind;
int ids[12] = { 0, 1, 2, 0, 3, 1, 2, 3, 0, 1, 3, 2 };
-//int ids[12] = { 2, 1, 0, 1, 3, 0, 0, 3, 2, 2, 3, 1 };
+ //int ids[12] = { 2, 1, 0, 1, 3, 0, 0, 3, 2, 2, 3, 1 };
for (int k = 0; k < 4; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 3; i++)
+ tofind.insert(nodes[ids[3 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 3; i++)
- tofind.insert(nodes[ids[3 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 3; i++)
- orderedNodes[i] = nodes[ids[3 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[3 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
set<int> tofind;
int ids[24] = { 0, 1, 2, 4, 5, 6, 0, 3, 1, 7, 8, 4, 2, 3, 0, 9, 7, 6, 1, 3, 2, 8, 9, 5 };
-//int ids[24] = { 2, 1, 0, 5, 4, 6, 1, 3, 0, 8, 7, 4, 0, 3, 2, 7, 9, 6, 2, 3, 1, 9, 8, 5 };
+ //int ids[24] = { 2, 1, 0, 5, 4, 6, 1, 3, 0, 8, 7, 4, 0, 3, 2, 7, 9, 6, 2, 3, 1, 9, 8, 5 };
for (int k = 0; k < 4; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 6; i++)
+ tofind.insert(nodes[ids[6 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 6; i++)
- tofind.insert(nodes[ids[6 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 6; i++)
- orderedNodes[i] = nodes[ids[6 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[6 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
for (int i = 0; i < 4; i++)
tofind.insert(nodes[ids[i]]);
if (setNodes == tofind)
- {
- for (int i = 0; i < 4; i++)
- orderedNodes[i] = nodes[ids[i]];
- return;
- }
+ {
+ for (int i = 0; i < 4; i++)
+ orderedNodes[i] = nodes[ids[i]];
+ return;
+ }
// Triangular faces
for (int k = 0; k < 4; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 3; i++)
+ tofind.insert(nodes[ids[4 + 3 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 3; i++)
- tofind.insert(nodes[ids[4 + 3 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 3; i++)
- orderedNodes[i] = nodes[ids[4 + 3 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[4 + 3 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
void SMDS_DownQuadPyramid::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType>& orderedNodes)
{
-// MESSAGE("SMDS_DownQuadPyramid::getOrderedNodesOfFace cellId = " << cellId);
+ // MESSAGE("SMDS_DownQuadPyramid::getOrderedNodesOfFace cellId = " << cellId);
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++)
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
for (int i = 0; i < 8; i++)
tofind.insert(nodes[ids[i]]);
if (setNodes == tofind)
- {
- for (int i = 0; i < 8; i++)
- orderedNodes[i] = nodes[ids[i]];
- return;
- }
+ {
+ for (int i = 0; i < 8; i++)
+ orderedNodes[i] = nodes[ids[i]];
+ return;
+ }
// Triangular faces
for (int k = 0; k < 4; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 6; i++)
+ tofind.insert(nodes[ids[8 + 6 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 6; i++)
- tofind.insert(nodes[ids[8 + 6 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 6; i++)
- orderedNodes[i] = nodes[ids[8 + 6 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[8 + 6 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2] << " " << orderedNodes[3]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++)
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
-//int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 };
+ //int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 };
int ids[18] = { 0, 1, 2, 3, 5, 4, 0, 3, 4, 1, 1, 4, 5, 2, 2, 5, 3, 0 };
// Triangular faces
for (int k = 0; k < 2; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 3; i++)
+ tofind.insert(nodes[ids[3 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 3; i++)
- tofind.insert(nodes[ids[3 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 3; i++)
- orderedNodes[i] = nodes[ids[3 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[3 * k + i]];
+ return;
}
+ }
// Quadrangular faces
for (int k = 0; k < 3; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 4; i++)
+ tofind.insert(nodes[ids[6 + 4 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 4; i++)
- tofind.insert(nodes[ids[6 + 4 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 4; i++)
- orderedNodes[i] = nodes[ids[6 + 4 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[6 + 4 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
int *faces = &_cellIds[_nbDownCells * cellId];
if (aType == VTK_QUAD)
for (int i = 0; i < 3; i++)
- {
+ {
if (faces[i] < 0)
{
faces[i] = lowCellId;
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
-//int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 };
+ //int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 };
int ids[36] = { 0, 1, 2, 6, 7, 8, 3, 5, 4, 11, 10, 9,
0, 3, 4, 1, 12, 9, 13, 6, 1, 4, 5, 2, 13, 10, 14, 7, 2, 5, 3, 0, 14, 11, 12, 8 };
// Triangular faces
for (int k = 0; k < 2; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 6; i++)
+ tofind.insert(nodes[ids[6 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 6; i++)
- tofind.insert(nodes[ids[6 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 6; i++)
- orderedNodes[i] = nodes[ids[6 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[6 * k + i]];
+ return;
}
+ }
// Quadrangular faces
for (int k = 0; k < 3; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 8; i++)
+ tofind.insert(nodes[ids[12 + 8 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 8; i++)
- tofind.insert(nodes[ids[12 + 8 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 8; i++)
- orderedNodes[i] = nodes[ids[12 + 8 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[12 + 8 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
-//int ids[24] = { 0, 1, 2, 3, 7, 6, 5, 4, 4, 0, 3, 7, 5, 1, 0, 4, 6, 2, 1, 5, 7, 3, 2, 6};
+ //int ids[24] = { 0, 1, 2, 3, 7, 6, 5, 4, 4, 0, 3, 7, 5, 1, 0, 4, 6, 2, 1, 5, 7, 3, 2, 6};
int ids[24] = { 3, 2, 1, 0, 4, 5, 6, 7, 7, 3, 0, 4, 4, 0, 1, 5, 5, 1, 2, 6, 6, 2, 3, 7};
for (int k = 0; k < 6; k++) // loop on the 6 faces
+ {
+ tofind.clear();
+ for (int i = 0; i < 4; i++)
+ tofind.insert(nodes[ids[4 * k + i]]); // node ids of the face i
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 4; i++)
- tofind.insert(nodes[ids[4 * k + i]]); // node ids of the face i
- if (setNodes == tofind)
- {
- for (int i = 0; i < 4; i++)
- orderedNodes[i] = nodes[ids[4 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[4 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2] << " " << orderedNodes[3]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
int ids[48] = { 3, 2, 1, 0,10, 9, 8,11, 4, 5, 6, 7,12,13,14,15, 7, 3, 0, 4,19,11,16,15,
4, 0, 1, 5,16, 8,17,12, 5, 1, 2, 6,17, 9,18,13, 6, 2, 3, 7,18,10,19,14};
for (int k = 0; k < 6; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 8; i++)
+ tofind.insert(nodes[ids[8 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 8; i++)
- tofind.insert(nodes[ids[8 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 8; i++)
- orderedNodes[i] = nodes[ids[8 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[8 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2] << " " << orderedNodes[3]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
/// Create an iterator which look for elements of type type which are linked
/// to the element element. it is the iterator to get connectivity of element
//////////////////////////////////////////////////////////////////////////////
-SMDS_IteratorOfElements::SMDS_IteratorOfElements(const SMDS_MeshElement * element,
- SMDSAbs_ElementType type,
+SMDS_IteratorOfElements::SMDS_IteratorOfElements(const SMDS_MeshElement * element,
+ SMDSAbs_ElementType type,
const SMDS_ElemIteratorPtr& it)
- : t1Iterator(it),
- t2Iterator(SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL)),
- myType(type), myElement(element),
- myProxyElement(NULL)
+ : t1Iterator(it),
+ t2Iterator(SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL)),
+ myType(type), myElement(element),
+ myProxyElement(NULL)
{
- while(subMore())
- alreadyReturnedElements.insert(subNext());
- itAlreadyReturned= alreadyReturnedElements.begin();
- switch(myElement->GetType())
- {
- case SMDSAbs_Node:
- case SMDSAbs_Edge: myReverseIteration=true; break;
- case SMDSAbs_Face: myReverseIteration=(type==SMDSAbs_Volume); break;
- default: myReverseIteration=false;
- }
+ while(subMore())
+ alreadyReturnedElements.insert(subNext());
+ itAlreadyReturned= alreadyReturnedElements.begin();
+ switch(myElement->GetType())
+ {
+ case SMDSAbs_Node:
+ case SMDSAbs_Edge: myReverseIteration=true; break;
+ case SMDSAbs_Face: myReverseIteration=(type==SMDSAbs_Volume); break;
+ default: myReverseIteration=false;
+ }
}
bool SMDS_IteratorOfElements::more()
const SMDS_MeshElement * next();
private:
- SMDS_ElemIteratorPtr t2Iterator;
SMDS_ElemIteratorPtr t1Iterator;
+ SMDS_ElemIteratorPtr t2Iterator;
SMDSAbs_ElementType myType;
- const SMDS_MeshElement * myProxyElement;
const SMDS_MeshElement * myElement;
+ const SMDS_MeshElement * myProxyElement;
bool myReverseIteration;
std::set<const SMDS_MeshElement*> alreadyReturnedElements;
MESSAGE("Internal Error: This should not happen");
break;
case SMDSAbs_0DElement:
+ case SMDSAbs_Ball:
{
}
break;
addChildrenWithNodes(setOfChildren, ite->next(), nodes);
}
}
+ case SMDSAbs_NbElementTypes:
case SMDSAbs_All: break;
}
}
reverseInterlaces[ smdsType ][pos++] = 0;
for ( int i = nbNodes / 2 - 1; i > 0 ; --i ) // 3,2,1
reverseInterlaces[ smdsType ][pos++] = i;
- for ( int i = nbNodes - 1; i >= nbNodes / 2; --i ) // 7,6,5,4
+ for ( int i = nbNodes - 1, nb = nbNodes / 2; i >= nb; --i ) // 7,6,5,4
reverseInterlaces[ smdsType ][pos++] = i;
}
}
{
int nbEdges = 0;
- for (int ifa = 0; ifa < myQuantities.size(); ifa++) {
+ for ( size_t ifa = 0; ifa < myQuantities.size(); ifa++) {
nbEdges += myQuantities[ifa];
}
nbEdges /= 2;
//=======================================================================
int SMDS_PolyhedralVolumeOfNodes::NbFaceNodes (const int face_ind) const
{
- if (face_ind < 1 || myQuantities.size() < face_ind)
+ if (face_ind < 1 || (int)myQuantities.size() < face_ind)
return 0;
return myQuantities[face_ind - 1];
}
class _MySubIterator : public SMDS_ElemIterator
{
vector< const SMDS_MeshElement* > myElems;
- int myIndex;
+ size_t myIndex;
public:
_MySubIterator(const SMDS_MeshVolume* vol, SMDSAbs_ElementType type):myIndex(0) {
SMDS_VolumeTool vTool(vol);
case 15: nbCorners = 6; break;
default: nbCorners = 8;
}
- for ( int i = nbCorners; i<myNodes.size(); i++) {
+ for ( size_t i = nbCorners; i<myNodes.size(); i++) {
if(myNodes[i]==node) return true;
}
return false;
class _MySubIterator : public SMDS_ElemIterator
{
vector< const SMDS_MeshElement* > myElems;
- int myIndex;
+ size_t myIndex;
public:
_MySubIterator(const SMDS_MeshVolume* vol, SMDSAbs_ElementType type):myIndex(0) {
SMDS_VolumeTool vTool(vol);
if ( !myVolume )
return false;
- for ( int i = 0; i < myVolumeNodes.size(); i++ ) {
+ for ( size_t i = 0; i < myVolumeNodes.size(); i++ ) {
X += myVolumeNodes[ i ]->X();
Y += myVolumeNodes[ i ]->Y();
Z += myVolumeNodes[ i ]->Z();
// find nodes indices
int i1 = -1, i2 = -1, nbFound = 0;
- for ( int i = 0; i < myVolumeNodes.size() && nbFound < 2; i++ )
+ for ( size_t i = 0; i < myVolumeNodes.size() && nbFound < 2; i++ )
{
if ( myVolumeNodes[ i ] == theNode1 )
i1 = i, ++nbFound;
int minInd = min( theNode1Index, theNode2Index );
int maxInd = max( theNode1Index, theNode2Index );
- if ( minInd < 0 || maxInd > myVolumeNodes.size() - 1 || maxInd == minInd )
+ if ( minInd < 0 || maxInd > (int)myVolumeNodes.size() - 1 || maxInd == minInd )
return false;
VolumeType type = GetVolumeType();
int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
{
if ( myVolume ) {
- for ( int i = 0; i < myVolumeNodes.size(); i++ ) {
+ for ( size_t i = 0; i < myVolumeNodes.size(); i++ ) {
if ( myVolumeNodes[ i ] == theNode )
return i;
}
{
edges.clear();
edges.reserve( myVolumeNodes.size() * 2 );
- for ( int i = 0; i < myVolumeNodes.size()-1; ++i ) {
- for ( int j = i + 1; j < myVolumeNodes.size(); ++j ) {
+ for ( size_t i = 0; i < myVolumeNodes.size()-1; ++i ) {
+ for ( size_t j = i + 1; j < myVolumeNodes.size(); ++j ) {
if ( IsLinked( i, j )) {
const SMDS_MeshElement* edge =
SMDS_Mesh::FindEdge( myVolumeNodes[i], myVolumeNodes[j] );
}
chrono::chrono(int i) :
- _ctr(i), _run(true)
+ _run(true), _ctr(i)
{
//MESSAGE("chrono::chrono " << _ctr << " " << _run);
_start = clock();
#define SMESHFILTERSSELECTION_EXPORT
#endif
-namespace SMESH{
+namespace SMESH {
enum MeshObjectType {
HYPOTHESIS,
ALGORITHM,
IDSOURCE_FACE,
IDSOURCE_VOLUME
};
-};
+}
#endif
Ok = isIDSourceOfType( obj, SMESH::VOLUME );
break;
}
+ default:;
}
}
return Ok;
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI : public SalomeApp_Module
{
- Q_OBJECT;
+ Q_OBJECT
public :
SMESHGUI();
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myGeomType( theType ),
- myBusy( false )
+ myBusy( false ),
+ myGeomType( theType )
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
myNbCenterNodes = 1;
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_hexahedrons
break;
+ default:;
}
myMidFaceLabel ->setVisible( myNbMidFaceNodes );
anIds.push_back( aListId[ 0 ].toInt() );
}
break;
+ default:;
}
if ( myReverseCB->isChecked())
ReverseConnectivity( anIds, myGeomType, /*toReverse=*/true, /*toVtkOrder=*/false );
case SMESH::VOLUME:
myActor->SetRepresentation(SMESH_Actor::eSurface);
myActor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break;
+ default:;
}
}
case SMDSEntity_Quad_Hexa:
case SMDSEntity_TriQuad_Hexa:
anElementType = SMESH::VOLUME; break;
+ default:;
}
myGroups.clear();
ComboBox_GroupName->clear();
okIDs.insert( anID );
}
- return okIDs.size() == myTable->rowCount() + myNbMidFaceNodes + myNbCenterNodes;
+ return (int) okIDs.size() == myTable->rowCount() + myNbMidFaceNodes + myNbCenterNodes;
}
//=================================================================================
aFirstColIds = FirstHexahedronIds;
aLastColIds = LastHexahedronIds;
break;
+ default:;
}
// fill the First and the Last columns
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog
{
- Q_OBJECT;
+ Q_OBJECT
public:
if (myViewWindow)
SMESH::RenderViewWindow(myViewWindow);
- for( int i=0; i< myPlanes.size(); i++ ) {
+ for ( size_t i = 0; i < myPlanes.size(); i++ ) {
SMESH::TPlaneData aPlaneData = myPlanes[i];
aPlaneData.Plane->Delete();
}
- if (myPreviewWidget) {
+ if ( myPreviewWidget ) {
myPreviewWidget->Off();
myPreviewWidget->Delete();
}
GEOM_Actor* getActor(const TopoDS_Shape& shape)
{
int index = myIndexToShape.FindIndex( shape ) - 1;
- if ( index < 0 || index >= myActors.size() )
+ if ( index < 0 || index >= (int) myActors.size() )
return 0;
GEOM_Actor* & actor = myActors[ index ];
if ( !actor ) {
#endif
aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
// check if there are memory problems
- for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
+ for ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB );
}
catch(const SALOME::SALOME_Exception & S_ex) {
aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aMeshObj, aMeshSObj) );
SMESH::submesh_array_var aSubMeshes = myMesh->GetSubMeshes();
// put SubMeshes into list
- for ( int i = 0; i < aSubMeshes->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < aSubMeshes->length(); i++ ) {
SMESH::SMESH_subMesh_var sm = aSubMeshes[i];
if ( CORBA::is_nil( sm ) ) continue;
_PTR(SObject) smSObj = SMESH::ObjectToSObject( sm );
else
{
bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported
- for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i )
+ for ( CORBA::ULong i = 0; i < theCompErrors->length() && onlyWarnings; ++i )
onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING ||
theCompErrors[ i ].code == SMESH::COMPERR_NO_MESH_ON_SHAPE );
tbl->setColumnWidth( COL_ERROR, 200 );
bool hasBadMesh = false;
- for ( int row = 0; row < theCompErrors->length(); ++row )
+ for ( int row = 0; row < (int) theCompErrors->length(); ++row )
{
SMESH::ComputeError & err = theCompErrors[ row ];
//================================================================================
/*!
* \brief Constructor
-*/
+ */
//================================================================================
SMESHGUI_PrecomputeOp::SMESHGUI_PrecomputeOp()
: SMESHGUI_BaseComputeOp(),
- myDlg( 0 ),
- myOrderMgr( 0 ),
myActiveDlg( 0 ),
- myPreviewDisplayer( 0 )
+ myDlg( 0 ),
+ myPreviewDisplayer( 0 ),
+ myOrderMgr( 0 )
{
}
#endif
aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
// check if there are memory problems
- for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
+ for ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB );
}
catch(const SALOME::SALOME_Exception & S_ex){
tbl->setColumnWidth( COL_ERROR, 200 );
bool hasBadMesh = false;
- for ( int row = 0; row < theCompErrors->length(); ++row )
+ for ( int row = 0; row < (int) theCompErrors->length(); ++row )
{
SMESH::ComputeError & err = theCompErrors[ row ];
}
}
break;
- }
+
+ default:;
+ } // switch( (*anIt).myValue.type() )
if( w )
{
{
SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
if( listSOmesh.size() > 0 )
- for( int i = 0; i < listSOmesh.size(); i++ )
+ for( size_t i = 0; i < listSOmesh.size(); i++ )
{
_PTR(SObject) submSO = listSOmesh[i];
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
{
QString valueStr = "";
ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
- uint len0 = 0;
- for( int i=0; param!=aLast; param++, i++ )
+ int len0 = 0;
+ for ( ; param != aLast; param++ )
{
if ( valueStr.length() > len0 ) {
valueStr += "; ";
Context( theContext ),
Dim( theDim ),
IsAuxOrNeedHyp( theIsAuxOrNeedHyp ),
+ IsNeedGeometry( theIsNeedGeometry ),
+ IsSupportSubmeshes( supportSub ),
BasicHypos( theBasicHypos ),
OptionalHypos( theOptionalHypos ),
InputTypes( theInputTypes ),
- OutputTypes( theOutputTypes ),
- IsNeedGeometry( theIsNeedGeometry ),
- IsSupportSubmeshes( supportSub )
+ OutputTypes( theOutputTypes )
{
}
//================================================================================
SMESHGUI_MeshOp::SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh )
: SMESHGUI_SelectionOp(),
- myToCreate( theToCreate ),
- myIsMesh( theIsMesh ),
myDlg( 0 ),
myShapeByMeshOp( 0 ),
+ myToCreate( theToCreate ),
+ myIsMesh( theIsMesh ),
myHypoSet( 0 )
{
if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
if (aSeq->length() > 0) {
shapeDim = -1;
- for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
+ for ( CORBA::ULong iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
GEOM::GEOM_Object_var aGeomVar = aSeq[iss];
switch ( aGeomVar->GetShapeType() ) {
case GEOM::SOLID: shapeDim = 3; break;
// check that tab enabled of one less dimension
if ( aDim > SMESH::DIM_0D )
{
- if ( isAccessibleDim( aDim - 1 ) ) {
- if ( algoData && myIsOnGeometry ) {
- for (int i = aDim - 1; i >= SMESH::DIM_0D; i--) {
- if ( isAccessibleDim( i ) && ( currentHyp( i, Algo ) < 0 ||
- algoData->InputTypes.isEmpty() ) ) {
+ if ( myIsOnGeometry ) {
+ QString anCompareType = currentMeshTypeName(myDlg->currentMeshType());
+ bool is2dtype = ( anCompareType == "QUAD" ) || ( anCompareType == "TRIA" );
+ int dim = is2dtype ? SMESH::DIM_2D : SMESH::DIM_3D;
+ for (int i = dim; i >= SMESH::DIM_0D; i--) {
+ if ( i != aDim ) {
+ if ( algoData && algoData->InputTypes.isEmpty() ) {
myDlg->disableTab( i );
setCurrentHyp(i, Algo, -1);
}
+ else {
+ myDlg->enableTab( i );
+ }
}
}
}
- if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() ) {
- myDlg->enableTab( aDim - 1 );
- }
- if ( !algoData ) {
- if ( aDim != SMESH::DIM_2D || ( aDim == SMESH::DIM_2D &&
- currentHyp( SMESH::DIM_2D, Algo ) < 0) ) {
- for (int i = aDim - 1; i >= SMESH::DIM_0D; i--)
- myDlg->enableTab( i );
- }
- else {
- for (int i = aDim - 1; i >= SMESH::DIM_0D; i--)
- myDlg->disableTab( i );
- }
- }
}
int algoDim = aDim;
{
// get hypotheses
existingHyps( dim, hypType, pObj, anExisting, myObjHyps[ dim ][ hypType ] );
+ if ( myObjHyps[ dim ][ hypType ].count() == 0 ) {
+ setCurrentHyp( dim, hypType, -1 );
+ }
for ( int i = 0, nb = myObjHyps[ dim ][ hypType ].count(); i < nb; ++i )
{
// find index of required hypothesis among existing ones for this dimension and type
setCurrentHyp( dim, Algo, anCurrentAvailableAlgo );
if ( anCurrentAvailableAlgo > -1 )
isReqDisBound = algoCur->InputTypes.isEmpty();
- else if ( dim != SMESH::DIM_3D && currentHyp( SMESH::DIM_3D, Algo ) >= 0 )
- isReqDisBound = true;
if ( isReqDisBound ) {
aReqDim = dim;
break;
}
else
for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) {
- if ( i > myMaxShapeDim || ( isReqDisBound && i < aReqDim ) ) myDlg->disableTab( i );
- else myDlg->enableTab( i );
+ if ( i > myMaxShapeDim || ( isReqDisBound && i != aReqDim ) ) myDlg->disableTab( i );
+ else myDlg->enableTab( i );
}
myDlg->setCurrentTab( theTabIndex );
}
setCurrentHyp( dim, Algo, anCurrentAvailableAlgo );
}
- if ( isNone || isReqDisBound ) {
- for ( int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++ ) {
- if ( aDim != i ) {
- myDlg->disableTab( i );
- }
- }
+ if ( aDim == SMESH::DIM_2D) {
+ myDlg->disableTab( SMESH::DIM_3D );
+ setCurrentHyp( SMESH::DIM_3D, Algo, -1);
}
- else if ( !isNone ) {
- if ( aDim == SMESH::DIM_2D) {
- myDlg->disableTab( SMESH::DIM_3D );
- setCurrentHyp( SMESH::DIM_3D, Algo, -1);
- }
- for ( int i = myMaxShapeDim; i > SMESH::DIM_0D; i-- ) {
- bool isNoneAlg = currentHyp( i, Algo ) < 0;
- if ( !isNoneAlg )
- isReqDisBound = myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty();
- else
- isReqDisBound = true;
- if ( isReqDisBound && isNoneAlg ) {
- for (int j = i - 1; j >= SMESH::DIM_0D; j--) {
- if ( j < aDim && currentHyp( j+1, Algo ) < 0 ) {
- myDlg->disableTab( j );
- setCurrentHyp( j , Algo, -1 );
- }
+ for ( int i = myMaxShapeDim; i > SMESH::DIM_0D; i-- ) {
+ bool isNoneAlg = currentHyp( i, Algo ) < 0;
+ if ( !isNoneAlg )
+ isReqDisBound = myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty();
+ else
+ isReqDisBound = true;
+ if ( isReqDisBound && !isNoneAlg) {
+ for (int j = i; j >= SMESH::DIM_0D; j--) {
+ if ( currentHyp( j, Algo ) < 0 ) {
+ myDlg->disableTab( j );
+ setCurrentHyp( j , Algo, -1 );
}
- break;
- }
- else if ( isNoneAlg ) {
- myDlg->disableTab( i );
}
+ break;
}
}
- myDlg->enableTab( aDim );
- myDlg->setCurrentTab( aDim );
+ int currentTab = ( theTabIndex <= aDim ) ? theTabIndex : aDim;
+ myDlg->setCurrentTab( currentTab );
}
THypDataList anAvailableAlgsData;
QStringList aHypothesesSetsList = SMESH::GetHypothesesSets( aDim );
bool myHasConcurrentSubBefore;
TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
- TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
+ TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
// edited mesh/sub-mesh
// hypdata corresponding to hypotheses present in myDlg
THypDataList myAvailableHypData[4][NbHypTypes];
QString myLastGeomToSelect;
THypLabelIsAppMap myHypMapIsApplicable;
bool myIgnoreAlgoSelection;
- HypothesesSet* myHypoSet;
- int myDim, myType, myMaxShapeDim;
+ HypothesesSet* myHypoSet;
+ int myDim, myType, myMaxShapeDim;
QString myObjectToSelect;
};
bool SMESH_File::getInts(std::vector<int>& ints)
{
- int i = 0;
+ size_t i = 0;
while ( i < ints.size() )
{
while ( !isdigit( *_pos ) && !eof()) ++_pos;
#else
ssize_t nbWritten = ::write( _file, data, size );
- return ( nbWritten == size );
+ return ( nbWritten == (ssize_t) size );
#endif
}
addedEdges.insert( bndSegs[i]._edge->twin() ).second )
{
v2n = v2Node.insert( make_pair( bndSegs[i]._edge->vertex0(), v2Node.size() + 1 )).first;
- int n0 = v2n->second;
+ size_t n0 = v2n->second;
if ( n0 == v2Node.size() )
text << "n" << n0 << " = m.AddNode( "
<< bndSegs[i]._edge->vertex0()->x() / theScale[0] << ", "
<< bndSegs[i]._edge->vertex0()->y() / theScale[1] << ", 0 )\n";
v2n = v2Node.insert( make_pair( bndSegs[i]._edge->vertex1(), v2Node.size() + 1 )).first;
- int n1 = v2n->second;
+ size_t n1 = v2n->second;
if ( n1 == v2Node.size() )
text << "n" << n1 << " = m.AddNode( "
<< bndSegs[i]._edge->vertex1()->x() / theScale[0] << ", "
else // bndSegs[ i ]._branchID > 0
{
dInd = +1;
- for ( edgeInd = 0; edgeInd < branchEdges[ brID ].size(); ++edgeInd )
+ for ( edgeInd = 0; edgeInd < (int)branchEdges[ brID ].size(); ++edgeInd )
if ( branchEdges[ brID ][ edgeInd ] == bndSegs[ i ]._edge )
break;
}
int di = ( points._params[0] == points._params[i] ) ? +1 : -1;
while ( points._params[i] == points._params[i+1] )
i += di;
- if ( i < 0 || i+1 >= points._params.size() )
+ if ( i < 0 || i+1 >= (int)points._params.size() )
i = 0;
}
if ( !points._maEdges[ i ].second ) // no branch at the EDGE end, look for a closest branch
{
- if ( i < points._maEdges.size() / 2 ) // near 1st point
+ if ( i < (int)points._maEdges.size() / 2 ) // near 1st point
{
- while ( i < points._maEdges.size()-1 && !points._maEdges[ i ].second )
+ while ( i < (int)points._maEdges.size()-1 && !points._maEdges[ i ].second )
++i;
edgeParam = edgeReverse;
}
if ( p._iEdge > _params.size()-1 )
return false;
if ( p._iEdge == _params.size()-1 )
- return u = 1.;
+ return ( u = 1. );
u = ( _params[ p._iEdge ] * ( 1 - p._edgeParam ) +
_params[ p._iEdge+1 ] * p._edgeParam );
{
// look for a VERTEX of the opposite EDGE
// iNext - next after all null-length segments
- while ( maE = ++iNext )
+ while (( maE = ++iNext ))
{
iSeg2 = getBndSegment( maE );
if ( !_boundary->isConcaveSegment( ie1, iSeg2 ))
else if ( isConcaPrev )
{
// all null-length segments passed, find their beginning
- while ( maE = iPrev.edgePrev() )
+ while (( maE = iPrev.edgePrev() ))
{
iSeg1 = getBndSegment( maE );
if ( _boundary->isConcaveSegment( edgeIDs1.back(), iSeg1 ))
BranchPoint divisionPnt;
divisionPnt._branch = this;
- for ( ++maIter, ++twIter; maIter.index() < _maEdges.size(); ++maIter, ++twIter )
+ for ( ++maIter, ++twIter; maIter.index() < (int)_maEdges.size(); ++maIter, ++twIter )
{
size_t ie1 = getGeomEdge( maIter.edge() );
size_t ie2 = getGeomEdge( twIter.edge() );
myFather(0),
myIsLeaf( false ),
myLimit( limit ),
- myLevel(0),
- myBox(0)
+ myBox(0),
+ myLevel(0)
{
//if ( !myLimit ) myLimit = new SMESH_TreeLimit();
}
{
vector<int> color;
string str = value;
- if ( str.at(0) == '#' && str.length() == 7 ) // color should be presented as a string (#aaaaaa, for example)
+ // color must be presented as a string of next form:
+ if ( str.at(0) == '#' && str.length() == 7 ) { // hexadecimal color ("#ffaa00", for example)
str = str.substr(1);
- for ( int i = 0; i < str.length()/2; i++ )
+ for ( size_t i = 0; i < str.length()/2; i++ )
if ( str.at(i*2) >= '0' && str.at(i*2) <= 'f' && str.at(i*2+1) >= '0' && str.at(i*2+1) <= 'f' )
color.push_back( strtol( str.substr( i*2, 2 ).c_str(), NULL, 16 ) );
+ }
+ else { // rgb color ("255,170,0", for example)
+ char* tempValue = strdup( value );
+ char* colorValue = strtok( tempValue, "," );
+ while ( colorValue != NULL ) {
+ int c_value = atoi( colorValue );
+ if ( c_value >= 0 && c_value <= 255 )
+ color.push_back( c_value );
+ colorValue = strtok( NULL, "," );
+ }
+ }
if ( color.size() == 3 ) { // color must have three valid component
SMESHDS_GroupBase::SetDefaultColor( Quantity_Color( color[0]/255., color[1]/255., color[2]/255., Quantity_TOC_RGB ) );
myDefaultGroupColor = value;
_CORBA_Octet* buffer = new _CORBA_Octet[real_size];
char tmp[3];
tmp[2]='\0';
- int c = -1;
+ uint c = -1;
for ( int i = 0; i < real_size; i++ )
{
memcpy( &(tmp[0]), &(theStream[i*3+1]), 2 );
SMDS_MeshElement::Filter & filter = *aFilter;
if ( aType == SMDSAbs_Node )
- for (int i=0; i<IDs.length(); i++) {
+ for ( CORBA::ULong i = 0; i < IDs.length(); i++ ) {
const SMDS_MeshElement * elem = aMesh->FindNode( IDs[i] );
if ( filter( elem ))
aMap.insert( aMap.end(), elem );
}
else
- for (int i=0; i<IDs.length(); i++) {
+ for ( CORBA::ULong i = 0; i<IDs.length(); i++) {
const SMDS_MeshElement * elem = aMesh->FindElement( IDs[i] );
if ( filter( elem ))
aMap.insert( aMap.end(), elem );
SMESH::long_array_var aElementsId = theObject->GetIDs();
if ( types->length() == 1 && types[0] == SMESH::NODE)
{
- for(int i = 0; i < aElementsId->length(); i++)
+ for ( CORBA::ULong i = 0; i < aElementsId->length(); i++ )
if ( const SMDS_MeshNode * n = theMeshDS->FindNode( aElementsId[i] ))
theNodeSet.insert( theNodeSet.end(), n);
}
{
SMDS_NodeIteratorPtr nIt = theMeshDS->nodesIterator();
while ( nIt->more( ))
- if( const SMDS_MeshElement * elem = nIt->next() )
+ if ( const SMDS_MeshElement * elem = nIt->next() )
theNodeSet.insert( elem->begin_nodes(), elem->end_nodes());
}
else
{
- for(int i = 0; i < aElementsId->length(); i++)
- if( const SMDS_MeshElement * elem = theMeshDS->FindElement( aElementsId[i] ))
+ for ( CORBA::ULong i = 0; i < aElementsId->length(); i++ )
+ if ( const SMDS_MeshElement * elem = theMeshDS->FindElement( aElementsId[i] ))
theNodeSet.insert( elem->begin_nodes(), elem->end_nodes());
}
}
SMDSAbs_ElementType elemType = (*theElements.begin())->GetType();
bool sameElemType = ( elemType == (*theElements.rbegin())->GetType() );
if ( sameElemType &&
- theMeshDS->GetMeshInfo().NbElements( elemType ) == theElements.size() )
+ theMeshDS->GetMeshInfo().NbElements( elemType ) == (int) theElements.size() )
return; // all the elements are in theElements
if ( !sameElemType )
list< int > IdList;
- for (int i = 0; i < IDsOfElements.length(); i++)
+ for ( CORBA::ULong i = 0; i < IDsOfElements.length(); i++ )
IdList.push_back( IDsOfElements[i] );
// Update Python script
initData();
list< int > IdList;
- for (int i = 0; i < IDsOfNodes.length(); i++)
+ for ( CORBA::ULong i = 0; i < IDsOfNodes.length(); i++)
IdList.push_back( IDsOfNodes[i] );
// Update Python script
SMESH::Controls::Filter::GetElementsId( getMeshDS(), predicate, seq );
// remove orphan nodes (if there are any)
- list< int > IdList;
- for ( int i = 0; i < seq.size(); i++ )
- IdList.push_back( seq[i] );
+ list< int > IdList( seq.begin(), seq.end() );
int nbNodesBefore = myMesh->NbNodes();
getEditor().Remove( IdList, true );
SMESH_TRY;
initData();
- for (int i = 0; i < IDsOfElements.length(); i++)
+ for ( CORBA::ULong i = 0; i < IDsOfElements.length(); i++ )
{
CORBA::Long index = IDsOfElements[i];
const SMDS_MeshElement * elem = getMeshDS()->FindElement(index);
arrayToSet(IDsOfElements, aMesh, elements, SMDSAbs_Face);
set<const SMDS_MeshNode*> fixedNodes;
- for (int i = 0; i < IDsOfFixedNodes.length(); i++) {
+ for ( CORBA::ULong i = 0; i < IDsOfFixedNodes.length(); i++) {
CORBA::Long index = IDsOfFixedNodes[i];
const SMDS_MeshNode * node = aMesh->FindNode(index);
if ( node )
idSourceToSet( theFaces[i], getMeshDS(), elemsNodes[0], SMDSAbs_Face );
list<double> angles;
- for (int i = 0; i < theAngles.length(); i++) {
+ for ( CORBA::ULong i = 0; i < theAngles.length(); i++ ) {
angles.push_back( theAngles[i] );
}
TIDSortedNodeSet nodes;
idSourceToNodeSet( theObject, getMeshDS(), nodes );
- for ( int i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
+ for ( CORBA::ULong i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
{
SMDS_ElemIteratorPtr nodeIt = myMesh_i->GetElements( theExceptSubMeshOrGroups[i],
SMESH::NODE );
aTPythonDump << this << ".MergeNodes([";
TIDSortedNodeSet setOfNodesToKeep;
- for ( int i = 0; i < NodesToKeep.length(); ++i )
+ for ( CORBA::ULong i = 0; i < NodesToKeep.length(); ++i )
{
prepareIdSource( NodesToKeep[i] );
SMDS_ElemIteratorPtr nodeIt = myMesh_i->GetElements( NodesToKeep[i], SMESH::NODE );
}
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
- for (int i = 0; i < GroupsOfNodes.length(); i++)
+ for ( CORBA::ULong i = 0; i < GroupsOfNodes.length(); i++ )
{
const SMESH::long_array& aNodeGroup = GroupsOfNodes[ i ];
aListOfListOfNodes.push_back( list< const SMDS_MeshNode* >() );
list< const SMDS_MeshNode* >& aListOfNodes = aListOfListOfNodes.back();
- for ( int j = 0; j < aNodeGroup.length(); j++ )
+ for ( CORBA::ULong j = 0; j < aNodeGroup.length(); j++ )
{
CORBA::Long index = aNodeGroup[ j ];
if ( const SMDS_MeshNode * node = aMesh->FindNode( index ))
::SMESH_MeshEditor::TListOfListOfElementsID aListOfListOfElementsID;
- for (int i = 0; i < GroupsOfElementsID.length(); i++) {
+ for ( CORBA::ULong i = 0; i < GroupsOfElementsID.length(); i++ ) {
const SMESH::long_array& anElemsIDGroup = GroupsOfElementsID[ i ];
aListOfListOfElementsID.push_back( list< int >() );
list< int >& aListOfElemsID = aListOfListOfElementsID.back();
- for ( int j = 0; j < anElemsIDGroup.length(); j++ ) {
+ for ( CORBA::ULong j = 0; j < anElemsIDGroup.length(); j++ ) {
CORBA::Long id = anElemsIDGroup[ j ];
aListOfElemsID.push_back( id );
}
SMDSAbs_ElementType( type ),
foundElems);
res->length( foundElems.size() );
- for ( int i = 0; i < foundElems.size(); ++i )
+ for ( size_t i = 0; i < foundElems.size(); ++i )
res[i] = foundElems[i]->GetID();
return res._retn();
SMDSAbs_ElementType( type ),
foundElems);
res->length( foundElems.size() );
- for ( int i = 0; i < foundElems.size(); ++i )
+ for ( size_t i = 0; i < foundElems.size(); ++i )
res[i] = foundElems[i]->GetID();
return res._retn();
RETCASE( SEW_TOPO_DIFF_SETS_OF_ELEMENTS );
RETCASE( SEW_BAD_SIDE1_NODES );
RETCASE( SEW_BAD_SIDE2_NODES );
+ RETCASE( SEW_INTERNAL_ERROR );
}
return SMESH::SMESH_MeshEditor::SEW_OK;
}
for ( CORBA::ULong iP = 0; iP < aGRP.length(); ++iP )
{
const SMESH::FreeBorderPart& aPART = aGRP[ iP ];
- if ( aPART.border < 0 || aPART.border >= freeBorders.borders.length() )
+ if ( aPART.border < 0 || aPART.border >= (int) freeBorders.borders.length() )
THROW_SALOME_CORBA_EXCEPTION("Invalid FreeBorderPart::border index", SALOME::BAD_PARAM);
const SMESH::FreeBorder& aBRD = freeBorders.borders[ aPART.border ];
- if ( aPART.node1 < 0 || aPART.node1 > aBRD.nodeIDs.length() )
+ if ( aPART.node1 < 0 || aPART.node1 > (int) aBRD.nodeIDs.length() )
THROW_SALOME_CORBA_EXCEPTION("Invalid FreeBorderPart::node1", SALOME::BAD_PARAM);
- if ( aPART.node2 < 0 || aPART.node2 > aBRD.nodeIDs.length() )
+ if ( aPART.node2 < 0 || aPART.node2 > (int) aBRD.nodeIDs.length() )
THROW_SALOME_CORBA_EXCEPTION("Invalid FreeBorderPart::node2", SALOME::BAD_PARAM);
- if ( aPART.nodeLast < 0 || aPART.nodeLast > aBRD.nodeIDs.length() )
+ if ( aPART.nodeLast < 0 || aPART.nodeLast > (int) aBRD.nodeIDs.length() )
THROW_SALOME_CORBA_EXCEPTION("Invalid FreeBorderPart::nodeLast", SALOME::BAD_PARAM);
// do not keep these nodes for further sewing as nodes can be removed by the sewing
theNodeSearcher = SMESH_MeshAlgos::GetNodeSearcher( *getMeshDS() );
vector<double> nodesCoords;
- for (int i = 0; i < theNodesCoords.length(); i++)
+ for ( CORBA::ULong i = 0; i < theNodesCoords.length(); i++)
{
nodesCoords.push_back( theNodesCoords[i] );
}
groupsOfThisMesh ->length( groups.length() );
groupsOfOtherMesh->length( groups.length() );
int nbGroups = 0, nbGroupsOfOtherMesh = 0;
- for ( int i = 0; i < groups.length(); ++i )
+ for ( CORBA::ULong i = 0; i < groups.length(); ++i )
{
SMESH::SMESH_Mesh_var m = groups[i]->GetMesh();
if ( myMesh_i != SMESH::DownCast<SMESH_Mesh_i*>( m ))
*/
void SetVariable(Handle(_pyCommand) theCommand,
const SMESH_ObjectStates* theStates,
- int position, int theArgNb)
+ size_t position, int theArgNb)
{
if(theStates->GetCurrectState().size() > position)
if(!theStates->GetCurrectState().at(position).IsEmpty())
//================================================================================
TState SMESH_ObjectStates::GetCurrectState() const
{
- if(_states.size() > _dumpstate)
+ if ( (int) _states.size() > _dumpstate)
return _states[_dumpstate];
TState empty;
return empty;
//================================================================================
void SMESH_NoteBook::ReplaceVariables()
{
- for(int i=0;i<_commands.size();i++)
+ for ( size_t i = 0 ; i < _commands.size(); i++ )
{
Handle(_pyCommand) aCmd = _commands[i];
TCollection_AsciiString aMethod = aCmd->GetMethod();
{
TState aCurrentState = aStates->GetCurrectState();
int argIndex = h->getParamIndex( aMethod, aCurrentState.size() );
- if ( 0 <= argIndex && argIndex < aCurrentState.size() &&
+ if ( 0 <= argIndex && argIndex < (int)aCurrentState.size() &&
!aCurrentState[argIndex].IsEmpty() )
aCmd->SetArg( 1, aCurrentState[argIndex] );
else
aState = new SMESH_ObjectStates(anObjType);
- for(int i = 0; i < aSections->length(); i++) {
+ for ( size_t i = 0; i < aSections->length(); i++ ) {
TState aVars;
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
- for ( int j = 0; j<aListOfVars.length(); j++)
+ for ( size_t j = 0; j < aListOfVars.length(); j++)
{
TCollection_AsciiString aVar(aListOfVars[j].in());
if(!aVar.IsEmpty() && aStudy->IsVariable(aVar.ToCString())) {
return;
// 2) Initialize all type of 1D Distribution hypothesis
- for(int i=0;i<_commands.size();i++){
- for(int j =0;j < aLDS.size();j++){
+ for ( size_t i = 0; i < _commands.size(); i++ ) {
+ for ( size_t j = 0; j < aLDS.size(); j++ ) {
TCollection_AsciiString aResultValue = _commands[i]->GetResultValue();
if(_commands[i]->GetMethod() == "CreateHypothesis" &&
aLDS[j]->HasDistribution(aResultValue)){
}
// 3) ... and replase variables ...
- for(int i=0;i<_commands.size();i++){
- for(int j =0;j < aLDS.size();j++){
+ for ( size_t i = 0; i < _commands.size(); i++ ) {
+ for ( size_t j = 0; j < aLDS.size(); j++ ) {
TCollection_AsciiString anObject = _commands[i]->GetObject();
if(aLDS[j]->HasDistribution(anObject)) {
TCollection_AsciiString SMESH_NoteBook::GetResultScript() const
{
TCollection_AsciiString aResult;
- for(int i=0;i<_commands.size();i++)
- aResult+=_commands[i]->GetString()+"\n";
+ for ( size_t i = 0; i < _commands.size(); i++ )
+ aResult += _commands[i]->GetString() + "\n";
return aResult;
}
//================================================================================
void SMESH_NoteBook::GetResultLines(std::list< TCollection_AsciiString >& lines) const
{
- for(int i=0;i<_commands.size();i++)
+ for ( size_t i = 0; i < _commands.size(); i++ )
lines.push_back( _commands[i]->GetString() );
}
istream & StdMeshers_Adaptive1D::LoadFrom(istream & load)
{
int dummyParam;
- bool isOK = (load >> myMinSize >> myMaxSize >> myDeflection >> dummyParam >> dummyParam);
+ bool isOK = static_cast<bool>(load >> myMinSize >> myMaxSize >> myDeflection >> dummyParam >> dummyParam);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
return load;
{
bool isOK = true;
int intVal;
- isOK = (load >> _begLength);
+ isOK = static_cast<bool>(load >> _begLength);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> _endLength);
+ isOK = static_cast<bool>(load >> _endLength);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_edgeIDs.reserve( intVal );
for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
}
return load;
{
bool ok;
- ok = ( load >> _sizeThreshold );
+ ok = static_cast<bool>( load >> _sizeThreshold );
for ( int ax = 0; ax < 3; ++ax )
{
if (ok)
{
size_t i = 0;
- ok = (load >> i );
+ ok = static_cast<bool>(load >> i );
if ( i > 0 && ok )
{
_coords[ax].resize( i );
for ( i = 0; i < _coords[ax].size() && ok; ++i )
- ok = (load >> _coords[ax][i] );
+ ok = static_cast<bool>(load >> _coords[ax][i] );
}
}
if (ok)
{
size_t i = 0;
- ok = (load >> i );
+ ok = static_cast<bool>(load >> i );
if ( i > 0 && ok )
{
_internalPoints[ax].resize( i );
for ( i = 0; i < _internalPoints[ax].size() && ok; ++i )
- ok = (load >> _internalPoints[ax][i] );
+ ok = static_cast<bool>(load >> _internalPoints[ax][i] );
}
}
if (ok)
{
size_t i = 0;
- ok = (load >> i );
+ ok = static_cast<bool>(load >> i );
if ( i > 0 && ok )
{
_spaceFunctions[ax].resize( i );
for ( i = 0; i < _spaceFunctions[ax].size() && ok; ++i )
- ok = (load >> _spaceFunctions[ax][i] );
+ ok = static_cast<bool>(load >> _spaceFunctions[ax][i] );
}
}
}
- ok = ( load >> _toAddEdges );
+ ok = static_cast<bool>( load >> _toAddEdges );
for ( int i = 0; i < 9 && ok; ++i )
- ok = ( load >> _axisDirs[i]);
+ ok = static_cast<bool>( load >> _axisDirs[i]);
for ( int i = 0; i < 3 && ok ; ++i )
- ok = ( load >> _fixedPoint[i]);
+ ok = static_cast<bool>( load >> _fixedPoint[i]);
return load;
}
int& di, double tol )
{
//val += values[0]; // input \a val is measured from 0.
- if ( i > values.size()-2 )
+ if ( i > (int) values.size()-2 )
i = values.size()-2;
else
- while ( i+2 < values.size() && val > values[ i+1 ])
+ while ( i+2 < (int) values.size() && val > values[ i+1 ])
++i;
while ( i > 0 && val < values[ i ])
--i;
if ( i > 0 && val - values[ i ] < tol )
di = -1;
- else if ( i+2 < values.size() && values[ i+1 ] - val < tol )
+ else if ( i+2 < (int) values.size() && values[ i+1 ] - val < tol )
di = 1;
else
di = 0;
if ( quad._eIntNodes[ iP ]->IsUsedInFace( polygon ))
quad._eIntNodes[ iP ]->_usedInFace = 0;
#endif
- int nbUsedEdgeNodes = 0;
+ size_t nbUsedEdgeNodes = 0;
_Face* prevPolyg = 0; // polygon previously created from this quad
while ( nbSplits > 0 )
else
{
_OrientedLink foundSplit;
- for ( int i = iS; i < splits.size() && !foundSplit; ++i )
+ for ( size_t i = iS; i < splits.size() && !foundSplit; ++i )
if (( foundSplit = splits[ i ]) &&
( n2->IsLinked( foundSplit.FirstNode()->_intPoint )))
{
{
sortVertexNodes( chainNodes, curNode, curFace );
}
- for ( int i = 0; i < chainNodes.size(); ++i )
+ for ( size_t i = 0; i < chainNodes.size(); ++i )
{
polygon.AddPolyLink( chainNodes[ i ], curNode );
curNode = chainNodes[ i ];
i = int(lineInd.I()) + dInd[iL][0];
j = int(lineInd.J()) + dInd[iL][1];
k = int(lineInd.K()) + dInd[iL][2];
- if ( i < 0 || i >= nbCells[0] ||
- j < 0 || j >= nbCells[1] ||
- k < 0 || k >= nbCells[2] ) continue;
+ if ( i < 0 || i >= (int) nbCells[0] ||
+ j < 0 || j >= (int) nbCells[1] ||
+ k < 0 || k >= (int) nbCells[2] ) continue;
const size_t hexIndex = _grid->CellIndex( i,j,k );
Hexahedron *& hex = allHexa[ hexIndex ];
planes._zProjs [0] = 0;
const double zFactor = _grid->_axes[ iDirZ ] * planes._zNorm;
const vector< double > & u = _grid->_coords[ iDirZ ];
- for ( int i = 1; i < planes._zProjs.size(); ++i )
+ for ( size_t i = 1; i < planes._zProjs.size(); ++i )
{
planes._zProjs [i] = zFactor * ( u[i] - u[0] );
}
{
bool isOut = false;
- const bool moreIntPoints = ( iP+1 < link._fIntPoints.size() );
+ const bool moreIntPoints = ( iP+1 < (int) link._fIntPoints.size() );
// get 2 _Node's
_Node* n1 = link._fIntNodes[ iP ];
// sort nodes accoring to the order of edges
_Node* orderNodes [20];
TGeomID orderShapeIDs[20];
- int nbN = 0;
+ size_t nbN = 0;
TGeomID id, *pID;
for ( e = edges.begin(); e != edges.end(); ++e )
{
map< TGeomID, vector< TGeomID > > edge2faceIDsMap;
TopExp_Explorer eExp;
Bnd_Box shapeBox;
- for ( int i = 0; i < faceVec.size(); ++i )
+ for ( size_t i = 0; i < faceVec.size(); ++i )
{
facesItersectors[i]._face = TopoDS::Face ( faceVec[i] );
facesItersectors[i]._faceID = grid._shapes.Add( faceVec[i] );
{
const _FaceSide& otherSide = other.GetSide( i );
int iMyCommon;
- if ( mySides.Contain( otherSide, &iMyCommon ) )
+ if ( mySides.Contain( otherSide, &iMyCommon ))
{
if ( internalEdges.Contains( otherSide.Edge( 0 )))
{
DUMP_VERT("Cont 2", mySides.GetSide(iMyCommon)->LastVertex());
DUMP_VERT("Cont 3", otherSide.FirstVertex());
DUMP_VERT("Cont 4", otherSide.LastVertex());
- if ( myChildren.empty() ) {
+
+ if ( myChildren.empty() )
+ {
myChildren.push_back( *this );
myFace.Nullify();
}
+ else // find iMyCommon in myChildren
+ {
+ for ( TChildIterator children = GetChildren(); children.more(); ) {
+ const _QuadFaceGrid& child = children.next();
+ if ( child.mySides.Contain( otherSide, &iMyCommon ))
+ break;
+ }
+ }
// orient new children equally
- int otherBottomIndex = ( 4 + i - iMyCommon + 2 ) % 4;
+ int otherBottomIndex = SMESH_MesherHelper::WrapIndex( i - iMyCommon + 2, 4 );
if ( other.IsComplex() )
for ( TChildIterator children = other.GetChildren(); children.more(); ) {
myChildren.push_back( children.next() );
if ( other.IsComplex() )
for ( TChildIterator children = other.GetChildren(); children.more(); )
{
- const _QuadFaceGrid& child = children.next();
+ const _QuadFaceGrid& child = children.next();
for ( int i = 0; i < 4; ++i )
mySides.AppendSide( child.GetSide(i) );
}
{
if ( childFace->SetBottomSide( bottom, &myBottomIndex ))
{
- TChildren::iterator orientedCild = childFace;
+ TChildren::iterator orientedChild = childFace;
for ( childFace = myChildren.begin(); childFace != childEnd; ++childFace ) {
- if ( childFace != orientedCild )
+ if ( childFace != orientedChild )
childFace->SetBottomSide( childFace->GetSide( myBottomIndex ));
}
if ( sideIndex )
*/
//================================================================================
-void _QuadFaceGrid::ReverseEdges(/*int e1, int e2*/)
+void _QuadFaceGrid::ReverseEdges()
{
myReverse = !myReverse;
if ( myChildren.empty() )
{
-// mySides.GetSide( e1 )->Reverse();
-// mySides.GetSide( e2 )->Reverse();
DumpVertices();
}
else
DumpVertices();
TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
for ( ; child != childEnd; ++child )
- child->ReverseEdges( /*e1, e2*/ );
+ child->ReverseEdges();
}
}
for ( ; edge != eEnd; ++edge ) {
myChildren.push_back( _FaceSide( *edge ));
myNbChildren++;
-// myVertices.insert( myChildren.back().myVertices.begin(),
-// myChildren.back().myVertices.end() );
myVertices.Add( myChildren.back().FirstVertex() );
myVertices.Add( myChildren.back().LastVertex() );
myChildren.back().SetID( Q_CHILD ); // not to splice them
//=======================================================================
//function : GetSide
-//purpose :
+//purpose :
//=======================================================================
_FaceSide* _FaceSide::GetSide(const int i)
istream & StdMeshers_Deflection1D::LoadFrom(istream & load)
{
- bool isOK = (load >> _value);
+ bool isOK = static_cast<bool>(load >> _value);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
return load;
double FunctionTable::integral( const int i ) const
{
- if( i>=0 && i<myData.size()-1 )
- return integral( i, myData[2*(i+1)]-myData[2*i] );
+ if ( i >= 0 && i < (int)myData.size()-1 )
+ return integral( i, myData[2*(i+1)] - myData[2*i] );
else
return 0;
}
if ( NbEdges() == 0 ) return myPoints;
StdMeshers_FaceSide* me = const_cast< StdMeshers_FaceSide* >( this );
- SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
+ //SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
SMESH_MesherHelper eHelper( *myProxyMesh->GetMesh() );
SMESH_MesherHelper fHelper( *myProxyMesh->GetMesh() );
fHelper.SetSubShape( myFace );
bool paramOK;
double eps = 1e-100;
- // sort nodes of all edges putting them into a map
+ // sort nodes of all edges by putting them into a map
map< double, const SMDS_MeshNode*> u2node;
vector< pair< double, const SMDS_MeshNode*> > u2nodeVec;
u2node.insert( u2node.end(), make_pair( 1., node ));
}
- if ( u2node.size() + nbProxyNodes != myNbPonits &&
- u2node.size() + nbProxyNodes != NbPoints( /*update=*/true ))
+ if ((int) u2node.size() + nbProxyNodes != myNbPonits &&
+ (int) u2node.size() + nbProxyNodes != NbPoints( /*update=*/true ))
{
MESSAGE("Wrong node parameters on edges, u2node.size():"
<<u2node.size()<<" != myNbPonits:"<<myNbPonits);
// set <constValue>
if ( isXConst )
- for ( iPt = 0; iPt < points.size(); ++iPt ) points[ iPt ].x = constValue;
+ for ( iPt = 0; iPt < (int)points.size(); ++iPt ) points[ iPt ].x = constValue;
else
- for ( iPt = 0; iPt < points.size(); ++iPt ) points[ iPt ].y = constValue;
+ for ( iPt = 0; iPt < (int)points.size(); ++iPt ) points[ iPt ].y = constValue;
} // if ( myPoints.empty())
int EdgeIndex = 0;
double prevNormPar = 0, paramSize = myNormPar[ EdgeIndex ];
- for (int i = 0 ; i < myFalsePoints.size(); ++i ) {
+ for ( size_t i = 0 ; i < myFalsePoints.size(); ++i ) {
double normPar = double(i) / double(nbSeg);
UVPtStruct & uvPt = (*points)[i];
uvPt.node = 0;
{
if ( NbEdges() == 0 ) return resultNodes;
- SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
+ //SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
SMESH_MesherHelper eHelper( *myProxyMesh->GetMesh() );
SMESH_MesherHelper fHelper( *myProxyMesh->GetMesh() );
fHelper.SetSubShape( myFace );
// Fill the result vector
if ( theEdgeInd < 0 &&
- u2node.size() != myNbPonits &&
- u2node.size() != NbPoints( /*update=*/true ))
+ (int) u2node.size() != myNbPonits &&
+ (int) u2node.size() != NbPoints( /*update=*/true ))
{
u2node.clear();
}
n = SMESH_Algo::VertexNode( V, sm, myProxyMesh->GetMesh(), /*checkV=*/false );
if (( !n ) &&
- (( i > 0 && i < NbEdges() ) || IsClosed() ))
+ (( i > 0 && (int) i < NbEdges() ) || IsClosed() ))
{
iE = SMESH_MesherHelper::WrapIndex( int(i)-1, NbEdges() );
sm = myProxyMesh->GetMeshDS()->MeshElements( myEdgeID[ iE ]);
if (msg) MESSAGE ( std::endl << msg );
MESSAGE_BEGIN ("NB EDGES: "<< myEdge.size() );
MESSAGE_ADD ( "nbPoints: "<<myNbPonits<<" vecSize: " << myPoints.size()<<" "<<myFalsePoints.size() );
- for ( int i=0; i<myEdge.size(); ++i)
+ for ( size_t i = 0; i < myEdge.size(); ++i )
{
MESSAGE_ADD ( "\t"<<i+1 );
MESSAGE_ADD ( "\tEDGE: " );
else {
TopAbs::Print(myEdge[i].Orientation(),cout)<<" "<<myEdge[i].TShape().operator->()<<endl;
MESSAGE_ADD ( "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->()
- << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() );
+ << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() );
}
MESSAGE_ADD ( "\tC2d: ");
-
+
if (myC2d[i].IsNull()) {
MESSAGE_ADD ( "NULL" );
}
else {
MESSAGE_ADD ( myC2d[i].operator->() );
}
-
+
MESSAGE_ADD ( "\tF: "<<myFirst[i]<< " L: "<< myLast[i] );
MESSAGE_END ( "\tnormPar: "<<myNormPar[i]<<endl );
}
TopoDS_Wire aWire;
BRep_Builder aBuilder;
aBuilder.MakeWire(aWire);
- for ( int i=0; i<myEdge.size(); ++i )
+ for ( size_t i = 0; i < myEdge.size(); ++i )
aBuilder.Add( aWire, myEdge[i] );
if ( myEdge.size() == 2 && IsClosed() )
int i = U * double( myPoints.size()-1 );
while ( i > 0 && myPoints[ i ].normParam > U )
--i;
- while ( i+1 < myPoints.size() && myPoints[ i+1 ].normParam < U )
+ while ( i+1 < (int)myPoints.size() && myPoints[ i+1 ].normParam < U )
++i;
double r = (( U - myPoints[ i ].normParam ) /
( myPoints[ i+1 ].normParam - myPoints[ i ].normParam ));
int intVal;
double dblVal;
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_params.clear();
_params.reserve( intVal );
for ( size_t i = 0; i < _params.capacity() && isOK; i++) {
- isOK = (load >> dblVal);
+ isOK = static_cast<bool>(load >> dblVal);
if ( isOK ) _params.push_back( dblVal );
}
}
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_nbsegs.clear();
_nbsegs.reserve( intVal );
for ( size_t i = 0; i < _nbsegs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _nbsegs.push_back( intVal );
}
}
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_edgeIDs.clear();
_edgeIDs.reserve( intVal );
for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
return load;
}
istream & StdMeshers_Geometric1D::LoadFrom(istream & load)
{
bool isOK = true;
- isOK = (load >> _begLength);
- isOK = (load >> _ratio);
+ isOK = static_cast<bool>(load >> _begLength);
+ isOK = static_cast<bool>(load >> _ratio);
if (isOK)
StdMeshers_Reversible1D::LoadFrom( load );
return true;
set<const SMDS_MeshNode*> nodesInInverseFaces;
- SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator(SMDSAbs_Face );
+ SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator( SMDSAbs_Face );
while ( fIt->more() )
{
const SMDS_MeshElement* face = fIt->next();
nodesInInverseFaces.insert( face->begin_nodes(), face->end_nodes() );
}
- return nodesInInverseFaces.size() != ( 6 + (nbF/2-1)*3 );
+ return (int)nodesInInverseFaces.size() != ( 6 + (nbF/2-1)*3 );
}
//================================================================================
int _nbBlocksFound;
#ifdef _DEBUG_ // want to get SIGSEGV in case of invalid index
-#define _grid_access_(pobj, i) pobj->_grid[ ((i) < pobj->_grid.size()) ? i : int(1e100)]
+#define _grid_access_(pobj, i) pobj->_grid[ ((i) < (int)pobj->_grid.size()) ? i : int(1e100)]
#else
#define _grid_access_(pobj, i) pobj->_grid[ i ]
#endif
//!< safely return a node by XY
const SMDS_MeshNode* node(int x, int y) const
{
- int i = _index( x, y );
- return ( i < 0 || i >= _side->_grid.size()) ? 0 : _side->_grid[i];
+ size_t i = _index( x, y );
+ return ( i >= _side->_grid.size() ) ? 0 : _side->_grid[i];
}
//!< Return an edge
SMESH_OrientedLink edge(EQuadEdge edge) const
//================================================================================
/*!
- * \brief Find and return number of submeshes corresponding to blocks
+ * \brief Find blocks and return their number
*/
//================================================================================
_allSides.push_back( _BlockSide() );
_BlockSide& side = _allSides.back();
- if ( !fillSide( side, face, *corner ) )
+ if ( !fillSide( side, face, *corner ))
{
if ( !_error.empty() )
return false;
ok = block.setSide( i, findBlockSide( B_FRONT, edgeOfFront[i], edgeOfAdj[i],
advAnalys, sidesAround));
// try to find a BACK side by a TOP one
- if ( ok || !advAnalys)
+ if ( ok || !advAnalys )
if ( !block._side[B_BACK] && block._side[B_TOP] )
ok = block.setSide( B_BACK, findBlockSide( B_TOP, Q_TOP, Q_TOP,
advAnalys, sidesAround ));
{
// check if just found block is same as one of previously found blocks
bool isSame = false;
- for ( int i = 1; i < _blocks.size() && !isSame; ++i )
+ for ( size_t i = 1; i < _blocks.size() && !isSame; ++i )
isSame = ( block._corners == _blocks[i-1]._corners );
ok = !isSame;
}
side._index._ySize = verRow1.size();
side._grid.resize( side._index.size(), NULL );
- for ( x = 0; x < horRow1.size(); ++x )
+ for ( x = 0; x < nbX; ++x )
{
side.setNode( x, 0, horRow1[x] );
side.setNode( x, 1, horRow2[x] );
}
- for ( y = 0; y < verRow1.size(); ++y )
+ for ( y = 0; y < nbY; ++y )
{
side.setNode( 0, y, verRow1[y] );
side.setNode( 1, y, verRow2[y] );
if ( !n ) return false;
prevSide = nextSide;
- nbChainLinks++;
+
+ if ( ++nbChainLinks > NB_QUAD_SIDES )
+ return false;
}
return ( n == n2 && nbChainLinks == NB_QUAD_SIDES );
SMESH_OrientedLink eAdja = _side[ adjacent[i] ].edge( edgeAdj[i] );
ok = ( eBack == eAdja );
}
+ ok = ok && ( _side[ B_BOTTOM ]._index.size() == _side[ B_TOP ]._index.size() &&
+ _side[ B_RIGHT ]._index.size() == _side[ B_LEFT ]._index.size() &&
+ _side[ B_FRONT ]._index.size() == _side[ B_BACK ]._index.size() );
return ok;
}
int entity = secondOrder ? SMDSEntity_Quad_Hexa : SMDSEntity_Hexa;
vector<int>& nbByType = aResMap[ aMesh.GetSubMesh( aShape )];
- if ( entity >= nbByType.size() )
+ if ( entity >= (int) nbByType.size() )
nbByType.resize( SMDSEntity_Last, 0 );
for ( int i = 0; i < nbBlocks; ++i )
{
bool isOK = true;
int a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_mode = a;
else
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_length = a;
else
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_precision = a;
else
{
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_maxArea = a;
else
{
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_maxVolume = a;
else
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
_length = a;
else
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
_preestimated = a;
else
load.clear(ios::badbit | load.rdstate());
bool pre;
- isOK = (load >> pre);
+ isOK = static_cast<bool>(load >> pre);
if ( isOK )
_preestimation = pre;
else
istream & StdMeshers_NumberOfLayers::LoadFrom(istream & load)
{
bool isOK = true;
- isOK = (load >> _nbLayers);
+ isOK = static_cast<bool>(load >> _nbLayers);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
return load;
int a;
// read number of segments
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
_numberOfSegments = a;
else
// (nb.segments, distr.type, some other params.),
// we wait here the ditribution type, which is integer
double scale_factor;
- isOK = (load >> scale_factor);
+ isOK = static_cast<bool>(load >> scale_factor);
a = (int)scale_factor;
// try to interprete ditribution type,
{
case DT_Scale:
{
- isOK = (load >> b);
+ isOK = static_cast<bool>(load >> b);
if (isOK)
_scaleFactor = b;
else
break;
case DT_TabFunc:
{
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
{
_table.resize(a, 0.);
for ( size_t i=0; i < _table.size(); i++ )
{
- isOK = (load >> b);
+ isOK = static_cast<bool>(load >> b);
if (isOK)
_table[i] = b;
else
case DT_ExprFunc:
{
string str;
- isOK = (load >> str);
+ isOK = static_cast<bool>(load >> str);
if (isOK)
_func = str;
else
if (_distrType == DT_TabFunc || _distrType == DT_ExprFunc)
{
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
_convMode = a;
else
// load reversed edges IDs
int intVal;
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK && _distrType != DT_Regular && intVal > 0 ) {
_edgeIDs.reserve( intVal );
for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
}
return load;
#include <IntAna_IntConicQuad.hxx>
#include <IntAna_Quadric.hxx>
-#include <TColgp_HArray1OfPnt.hxx>
-#include <TColgp_HArray1OfVec.hxx>
-#include <TColgp_HSequenceOfPnt.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array1OfVec.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <gp_Lin.hxx>
//=======================================================================
static bool HasIntersection(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
- Handle(TColgp_HSequenceOfPnt)& aContour)
+ TColgp_SequenceOfPnt& aContour)
{
- if(aContour->Length()==3) {
- return HasIntersection3( P, PC, Pint, aContour->Value(1),
- aContour->Value(2), aContour->Value(3) );
+ if ( aContour.Length() == 3 ) {
+ return HasIntersection3( P, PC, Pint, aContour(1), aContour(2), aContour(3) );
}
else {
bool check = false;
- if( (aContour->Value(1).Distance(aContour->Value(2)) > 1.e-6) &&
- (aContour->Value(1).Distance(aContour->Value(3)) > 1.e-6) &&
- (aContour->Value(2).Distance(aContour->Value(3)) > 1.e-6) ) {
- check = HasIntersection3( P, PC, Pint, aContour->Value(1),
- aContour->Value(2), aContour->Value(3) );
+ if( (aContour(1).Distance(aContour(2)) > 1.e-6) &&
+ (aContour(1).Distance(aContour(3)) > 1.e-6) &&
+ (aContour(2).Distance(aContour(3)) > 1.e-6) ) {
+ check = HasIntersection3( P, PC, Pint, aContour(1), aContour(2), aContour(3) );
}
if(check) return true;
- if( (aContour->Value(1).Distance(aContour->Value(4)) > 1.e-6) &&
- (aContour->Value(1).Distance(aContour->Value(3)) > 1.e-6) &&
- (aContour->Value(4).Distance(aContour->Value(3)) > 1.e-6) ) {
- check = HasIntersection3( P, PC, Pint, aContour->Value(1),
- aContour->Value(3), aContour->Value(4) );
+ if( (aContour(1).Distance(aContour(4)) > 1.e-6) &&
+ (aContour(1).Distance(aContour(3)) > 1.e-6) &&
+ (aContour(4).Distance(aContour(3)) > 1.e-6) ) {
+ check = HasIntersection3( P, PC, Pint, aContour(1), aContour(3), aContour(4) );
}
if(check) return true;
}
myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *aMesh.GetMeshDS() );
SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
- //SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
- //cout<<" CheckIntersection: meshDS->NbFaces() = "<<meshDS->NbFaces()<<endl;
bool res = false;
- double dist = RealLast(); // find intersection closest to the segment
+ double dist = RealLast(); // find intersection closest to PC
gp_Pnt Pres;
gp_Ax1 line( P, gp_Vec(P,PC));
vector< const SMDS_MeshElement* > suspectElems;
searcher->GetElementsNearLine( line, SMDSAbs_Face, suspectElems);
+ TColgp_SequenceOfPnt aContour;
for ( size_t iF = 0; iF < suspectElems.size(); ++iF )
{
const SMDS_MeshElement* face = suspectElems[iF];
if ( face == NotCheckedFace ) continue;
- Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
+ aContour.Clear();
for ( int i = 0; i < face->NbCornerNodes(); ++i )
- aContour->Append( SMESH_TNodeXYZ( face->GetNode(i) ));
- if( HasIntersection(P, PC, Pres, aContour) ) {
+ aContour.Append( SMESH_TNodeXYZ( face->GetNode(i) ));
+ if ( HasIntersection(P, PC, Pres, aContour)) {
res = true;
double tmp = PC.Distance(Pres);
if ( tmp < dist ) {
//================================================================================
int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face,
- Handle(TColgp_HArray1OfPnt)& PN,
- Handle(TColgp_HArray1OfVec)& VN,
+ TColgp_Array1OfPnt& PN,
+ TColgp_Array1OfVec& VN,
vector<const SMDS_MeshNode*>& FNodes,
gp_Pnt& PC,
gp_Vec& VNorm,
for ( i = 0; i < 4; ++i )
{
gp_XYZ p = SMESH_TNodeXYZ( FNodes[i] = face->GetNode(i) );
- PN->SetValue( i+1, p );
+ PN.SetValue( i+1, p );
xyzC += p;
}
PC = xyzC/4;
for(i=1; i<4; i++) {
j = i+1;
for(; j<=4; j++) {
- if( PN->Value(i).Distance(PN->Value(j)) < 1.e-6 )
+ if( PN(i).Distance(PN(j)) < 1.e-6 )
break;
}
if(j<=4) break;
if(i<4) {
//cout<<"find degeneration"<<endl;
hasdeg = true;
- gp_Pnt Pdeg = PN->Value(i);
+ gp_Pnt Pdeg = PN(i);
list< const SMDS_MeshNode* >::iterator itdg = myDegNodes.begin();
const SMDS_MeshNode* DegNode = 0;
FNodes[i-1] = DegNode;
}
for(i=j; i<4; i++) {
- PN->SetValue(i,PN->Value(i+1));
+ PN.SetValue(i,PN.Value(i+1));
FNodes[i-1] = FNodes[i];
}
nbp = 3;
}
- PN->SetValue(nbp+1,PN->Value(1));
+ PN.SetValue(nbp+1,PN(1));
FNodes[nbp] = FNodes[0];
// find normal direction
- gp_Vec V1(PC,PN->Value(nbp));
- gp_Vec V2(PC,PN->Value(1));
+ gp_Vec V1(PC,PN(nbp));
+ gp_Vec V2(PC,PN(1));
VNorm = V1.Crossed(V2);
- VN->SetValue(nbp,VNorm);
+ VN.SetValue(nbp,VNorm);
for(i=1; i<nbp; i++) {
- V1 = gp_Vec(PC,PN->Value(i));
- V2 = gp_Vec(PC,PN->Value(i+1));
+ V1 = gp_Vec(PC,PN(i));
+ V2 = gp_Vec(PC,PN(i+1));
gp_Vec Vtmp = V1.Crossed(V2);
- VN->SetValue(i,Vtmp);
+ VN.SetValue(i,Vtmp);
VNorm += Vtmp;
}
myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS );
const SMESHDS_SubMesh * aSubMeshDSFace;
- Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5);
- Handle(TColgp_HArray1OfVec) VN = new TColgp_HArray1OfVec(1,4);
+ TColgp_Array1OfPnt PN(1,5);
+ TColgp_Array1OfVec VN(1,4);
vector<const SMDS_MeshNode*> FNodes(5);
gp_Pnt PC;
gp_Vec VNorm;
for(; i<=4; i++) {
gp_Pnt Pbest;
if(!isRev)
- Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i).Reversed());
+ Pbest = FindBestPoint(PN(i), PN(i+1), PC, VN(i).Reversed());
else
- Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i));
+ Pbest = FindBestPoint(PN(i), PN(i+1), PC, VN(i));
xc += Pbest.X();
yc += Pbest.Y();
zc += Pbest.Z();
// check PCbest
double height = PCbest.Distance(PC);
- if(height<1.e-6) {
+ if ( height < 1.e-6 ) {
// create new PCbest using a bit shift along VNorm
PCbest = PC.XYZ() + VNorm.XYZ() * 0.001;
}
else {
// check possible intersection with other faces
gp_Pnt Pint;
- bool check = CheckIntersection(PCbest, PC, Pint, aMesh, aShape, face);
- if(check) {
- //cout<<"--PC("<<PC.X()<<","<<PC.Y()<<","<<PC.Z()<<")"<<endl;
- //cout<<" PCbest("<<PCbest.X()<<","<<PCbest.Y()<<","<<PCbest.Z()<<")"<<endl;
+ gp_Vec VB(PC,PCbest);
+ gp_Pnt PCbestTmp = PC.XYZ() + VB.XYZ() * 3.0;
+ bool hasInters = CheckIntersection(PCbestTmp, PC, Pint, aMesh, aShape, face);
+ if ( hasInters ) {
double dist = PC.Distance(Pint)/3.;
- gp_Dir aDir(gp_Vec(PC,PCbest));
- PCbest = PC.XYZ() + aDir.XYZ() * dist;
- }
- else {
- gp_Vec VB(PC,PCbest);
- gp_Pnt PCbestTmp = PC.XYZ() + VB.XYZ() * 3.0;
- check = CheckIntersection(PCbestTmp, PC, Pint, aMesh, aShape, face);
- if(check) {
- double dist = PC.Distance(Pint)/3.;
- if(dist<height) {
- gp_Dir aDir(gp_Vec(PC,PCbest));
- PCbest = PC.XYZ() + aDir.XYZ() * dist;
- }
+ if ( dist < height ) {
+ gp_Dir aDir( VB );
+ PCbest = PC.XYZ() + aDir.XYZ() * dist;
}
}
}
myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS );
SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
+ TColgp_Array1OfPnt PN(1,5);
+ TColgp_Array1OfVec VN(1,4);
+ vector<const SMDS_MeshNode*> FNodes(5);
+ TColgp_SequenceOfPnt aContour;
+
SMDS_FaceIteratorPtr fIt = meshDS->facesIterator(/*idInceasingOrder=*/true);
while( fIt->more())
{
const SMDS_MeshElement* face = fIt->next();
if ( !face ) continue;
// retrieve needed information about a face
- Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5);
- Handle(TColgp_HArray1OfVec) VN = new TColgp_HArray1OfVec(1,4);
- vector<const SMDS_MeshNode*> FNodes(5);
gp_Pnt PC;
gp_Vec VNorm;
const SMDS_MeshElement* volumes[2];
SMDS_MeshFace* NewFace;
// check orientation
- double tmp = PN->Value(1).Distance(PN->Value(2)) + PN->Value(2).Distance(PN->Value(3));
+ double tmp = PN(1).Distance(PN(2)) + PN(2).Distance(PN(3));
// far points in VNorm direction
gp_Pnt Ptmp1 = PC.XYZ() + VNorm.XYZ() * tmp * 1.e6;
gp_Pnt Ptmp2 = PC.XYZ() - VNorm.XYZ() * tmp * 1.e6;
for ( size_t iF = 0; iF < suspectElems.size(); ++iF ) {
const SMDS_MeshElement* F = suspectElems[iF];
if ( F == face ) continue;
- Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
+ aContour.Clear();
for ( int i = 0; i < 4; ++i )
- aContour->Append( SMESH_TNodeXYZ( F->GetNode(i) ));
+ aContour.Append( SMESH_TNodeXYZ( F->GetNode(i) ));
gp_Pnt PPP;
if ( !volumes[0] && HasIntersection( Ptmp1, PC, PPP, aContour )) {
IsOK1 = true;
gp_XYZ PCbest(0., 0., 0.); // pyramid peak
int i = 1;
for ( ; i <= 4; i++ ) {
- gp_Pnt Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i));
+ gp_Pnt Pbest = FindBestPoint(PN(i), PN(i+1), PC, VN(i));
PCbest += Pbest.XYZ();
}
PCbest /= 4;
// Restrict pyramid height by intersection with other faces
gp_Vec tmpDir(PC,PCbest); tmpDir.Normalize();
- double tmp = PN->Value(1).Distance(PN->Value(3)) + PN->Value(2).Distance(PN->Value(4));
+ double tmp = PN(1).Distance(PN(3)) + PN(2).Distance(PN(4));
// far points: in (PC, PCbest) direction and vice-versa
gp_Pnt farPnt[2] = { PC.XYZ() + tmpDir.XYZ() * tmp * 1.e6,
PC.XYZ() - tmpDir.XYZ() * tmp * 1.e6 };
{
const SMDS_MeshElement* F = suspectElems[iF];
if ( F == face ) continue;
- Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
- int nbN = F->NbNodes() / ( F->IsQuadratic() ? 2 : 1 );
+ aContour.Clear();
+ int nbN = F->NbCornerNodes();
for ( i = 0; i < nbN; ++i )
- aContour->Append( SMESH_TNodeXYZ( F->GetNode(i) ));
+ aContour.Append( SMESH_TNodeXYZ( F->GetNode(i) ));
gp_Pnt intP;
for ( int isRev = 0; isRev < 2; ++isRev )
{
class SMDS_MeshElement;
class SMDS_MeshNode;
class SMDS_MeshFace;
-class Handle_TColgp_HArray1OfPnt;
-class Handle_TColgp_HArray1OfVec;
+class TColgp_Array1OfPnt;
+class TColgp_Array1OfVec;
class gp_Pnt;
class gp_Vec;
protected:
int Preparation(const SMDS_MeshElement* face,
- Handle_TColgp_HArray1OfPnt& PN,
- Handle_TColgp_HArray1OfVec& VN,
+ TColgp_Array1OfPnt& PN,
+ TColgp_Array1OfVec& VN,
std::vector<const SMDS_MeshNode*>& FNodes,
gp_Pnt& PC, gp_Vec& VNorm,
const SMDS_MeshElement** volumes=0);
istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
{
bool isOK = true;
- isOK = (load >> _triaVertexID);
+ isOK = static_cast<bool>(load >> _triaVertexID);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
int type;
- isOK = (load >> type);
+ isOK = static_cast<bool>(load >> type);
if (isOK)
_quadType = StdMeshers_QuadType(type);
// 0 bottom 1
- const int bfrom = quad->side[0].from;
- const int rfrom = quad->side[1].from;
+ //const int bfrom = quad->side[0].from;
+ //const int rfrom = quad->side[1].from;
const int tfrom = quad->side[2].from;
- const int lfrom = quad->side[3].from;
+ //const int lfrom = quad->side[3].from;
{
const vector<UVPtStruct>& uv_eb_vec = quad->side[0].GetUVPtStruct(true,0);
const vector<UVPtStruct>& uv_er_vec = quad->side[1].GetUVPtStruct(false,1);
} // if ( dv != 0 && dh != 0 )
- const int db = quad->side[0].IsReversed() ? -1 : +1;
- const int dr = quad->side[1].IsReversed() ? -1 : +1;
+ //const int db = quad->side[0].IsReversed() ? -1 : +1;
+ //const int dr = quad->side[1].IsReversed() ? -1 : +1;
const int dt = quad->side[2].IsReversed() ? -1 : +1;
- const int dl = quad->side[3].IsReversed() ? -1 : +1;
+ //const int dl = quad->side[3].IsReversed() ? -1 : +1;
// Case dv == 0, here possibly myQuadList.size() > 1
//
const vector<UVPtStruct>& uv_et = quad->side[2].GetUVPtStruct(true,1);
const vector<UVPtStruct>& uv_el = quad->side[3].GetUVPtStruct(false,0);
- if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl)
+ if ((int) uv_eb.size() != nb || (int) uv_er.size() != nr ||
+ (int) uv_et.size() != nt || (int) uv_el.size() != nl)
return error(COMPERR_BAD_INPUT_MESH);
// arrays for normalized params
const vector<UVPtStruct>& uv_et = quad->side[2].GetUVPtStruct(true,1);
const vector<UVPtStruct>& uv_el = quad->side[3].GetUVPtStruct(false,0);
- if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl)
+ if ((int) uv_eb.size() != nb || (int) uv_er.size() != nr ||
+ (int) uv_et.size() != nt || (int) uv_el.size() != nl)
return error(COMPERR_BAD_INPUT_MESH);
gp_UV uv[ UV_SIZE ];
// check if there are possible variations in choosing corners
bool haveVariants = false;
- if ( vertexByAngle.size() > nbCorners )
+ if ((int) vertexByAngle.size() > nbCorners )
{
double lostAngle = a2v->first;
double lastAngle = ( --a2v, a2v->first );
}
const double angleTol = 5.* M_PI/180;
- myCheckOri = ( vertexByAngle.size() > nbCorners ||
+ myCheckOri = ( (int)vertexByAngle.size() > nbCorners ||
vertexByAngle.begin()->first < angleTol );
// make theWire begin from a corner vertex or triaVertex
{
// select two halfDivider's as corners
TGeoIndex hd1, hd2 = -1;
- int iC2;
+ size_t iC2;
for ( iC2 = 0; iC2 < cornerInd.size() && hd2 < 0; ++iC2 )
{
hd1 = cornerInd[ iC2 ];
vector< double > accuLength;
double totalLen = 0;
vector< TGeoIndex > evVec( equVerts.begin(), equVerts.end() );
- int iEV = 0;
+ size_t iEV = 0;
TGeoIndex iE = cornerInd[ helper.WrapIndex( iC - nbC[0] - 1, cornerInd.size() )];
TGeoIndex iEEnd = cornerInd[ helper.WrapIndex( iC + nbC[1] + 1, cornerInd.size() )];
- while ( accuLength.size() < nbEqualV + int( !allCornersSame ) )
+ while ((int) accuLength.size() < nbEqualV + int( !allCornersSame ) )
{
// accumulate length of edges before iEV-th equal vertex
accuLength.push_back( totalLen );
quadsBySide[ (*quadIt)->side[iSide] ].push_back( *quadIt );
}
- SMESH_Mesh* mesh = myHelper->GetMesh();
- SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
const TopoDS_Face& face = TopoDS::Face( myHelper->GetSubShape() );
Handle(Geom_Surface) surf = BRep_Tool::Surface( face );
continue;
const vector<UVPtStruct>& oGrid = side.contacts[iC].other_side->grid->GetUVPtStruct();
const UVPtStruct& uvPt = points[ side.contacts[iC].point ];
- if ( side.contacts[iC].other_point >= oGrid .size() ||
- side.contacts[iC].point >= points.size() )
+ if ( side.contacts[iC].other_point >= (int) oGrid .size() ||
+ side.contacts[iC].point >= (int) points.size() )
throw SALOME_Exception( "StdMeshers_Quadrangle_2D::addEnforcedNodes(): wrong contact" );
if ( oGrid[ side.contacts[iC].other_point ].node )
(( UVPtStruct& ) uvPt).node = oGrid[ side.contacts[iC].other_point ].node;
return;
}
- const int iFrom = Min ( iForced, *iNext );
- const int iTo = Max ( iForced, *iNext ) + 1;
- const int sideSize = iTo - iFrom;
+ const int iFrom = Min ( iForced, *iNext );
+ const int iTo = Max ( iForced, *iNext ) + 1;
+ const size_t sideSize = iTo - iFrom;
vector<UVPtStruct> points[4]; // side points of a temporary quad
for ( int is2nd = 0; is2nd < 2; ++is2nd )
{
points[ is2nd ].reserve( sideSize );
- int nbLoops = 0;
+ size_t nbLoops = 0;
while ( points[is2nd].size() < sideSize )
{
int iCur = iFrom + points[is2nd].size() - int( !points[is2nd].empty() );
void FaceQuadStruct::Side::AddContact( int ip, Side* side, int iop )
{
- if ( ip >= GetUVPtStruct().size() ||
- iop >= side->GetUVPtStruct().size() )
+ if ( ip >= (int) GetUVPtStruct().size() ||
+ iop >= (int) side->GetUVPtStruct().size() )
throw SALOME_Exception( "FaceQuadStruct::Side::AddContact(): wrong point" );
if ( ip < from || ip >= to )
return;
gp_Vec2d aVec2d(PC,p2dV);
Nodes1.resize( myLayerPositions.size()+1 );
Nodes2.resize( myLayerPositions.size()+1 );
- int i = 0;
- for(; i<myLayerPositions.size(); i++) {
+ size_t i = 0;
+ for ( ; i < myLayerPositions.size(); i++ ) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i],
P0.Z() + aVec.Z()*myLayerPositions[i] );
meshDS->SetNodeOnEdge(NC, edgeID, cp);
Nodes1.resize( myLayerPositions.size()+1 );
Nodes2.resize( myLayerPositions.size()+1 );
- int i = 0;
+ size_t i = 0;
for(; i<myLayerPositions.size(); i++) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i],
bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF );
NC = const_cast<SMDS_MeshNode*>
( nodesFromP0ToP1 ? theNodes.begin()->second : theNodes.rbegin()->second );
- int i = 0, ir = Nodes1.size()-1;
- int * pi = nodesFromP0ToP1 ? &i : &ir;
+ size_t i = 0, ir = Nodes1.size()-1;
+ size_t * pi = nodesFromP0ToP1 ? &i : &ir;
itn = theNodes.begin();
if ( nodesFromP0ToP1 ) ++itn;
for ( ; i < Nodes1.size(); ++i, --ir, ++itn )
meshDS->SetNodeOnVertex(NC, vertID);
}
double dp = lp-fp;
- int i = 0;
- for(; i<myLayerPositions.size(); i++) {
+ size_t i = 0;
+ for ( ; i < myLayerPositions.size(); i++ ) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i],
P0.Z() + aVec.Z()*myLayerPositions[i] );
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
Nodes1[i] = node;
double param;
- if(!ori)
+ if ( !ori )
param = fp + dp*(1-myLayerPositions[i]);
else
param = fp + dp*myLayerPositions[i];
// create 1D elements on edge
SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
- for(i=1; i<Nodes1.size(); i++) {
+ for ( i = 1; i < Nodes1.size(); i++ ) {
ME = myHelper->AddEdge( Nodes1[i-1], Nodes1[i] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
}
- if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
+ if ( nbe == 2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
Nodes2 = Nodes1;
}
markEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F ));
return error("Invalid mesh on a straight edge");
bool nodesFromP0ToP2 = ( theNodes.rbegin()->second == NL );
- int i = 0, ir = Nodes1.size()-1;
- int * pi = nodesFromP0ToP2 ? &i : &ir;
+ size_t i = 0, ir = Nodes1.size()-1;
+ size_t * pi = nodesFromP0ToP2 ? &i : &ir;
itn = theNodes.begin();
if ( nodesFromP0ToP2 ) ++itn;
for ( ; i < Nodes2.size(); ++i, --ir, ++itn )
PC = PL;
}
double dp = lp-fp;
- for(int i=0; i<myLayerPositions.size(); i++) {
+ for ( size_t i = 0; i < myLayerPositions.size(); i++ ) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i],
P0.Z() + aVec.Z()*myLayerPositions[i] );
Nodes2[ myLayerPositions.size() ] = NL;
// create 1D elements on edge
SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes2[0] );
- if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
- for(int i=1; i<Nodes2.size(); i++) {
+ if ( ME ) meshDS->SetMeshElementOnShape(ME, edgeID);
+ for ( size_t i = 1; i < Nodes2.size(); i++ ) {
ME = myHelper->AddEdge( Nodes2[i-1], Nodes2[i] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
}
// create faces
tmpNodes.push_back( CNodes[i] );
// quad
- for(j=0; j<Nodes1.size()-1; j++) {
+ for ( j = 0; j < (int)Nodes1.size() - 1; j++ ) {
SMDS_MeshFace* MF;
if(IsForward)
MF = myHelper->AddFace( tmpNodes[j], Nodes1[j],
MF = myHelper->AddFace( NC, Nodes1[0], tmpNodes[0] );
else
MF = myHelper->AddFace( NC, tmpNodes[0], Nodes1[0] );
- if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
- for(j=0; j<Nodes1.size(); j++) {
+ if ( MF ) meshDS->SetMeshElementOnShape(MF, faceID);
+ for ( j = 0; j < (int) Nodes1.size(); j++ ) {
Nodes1[j] = tmpNodes[j];
}
}
// create last faces
// quad
- for(i=0; i<Nodes1.size()-1; i++) {
+ for ( i = 0; i < (int)Nodes1.size()-1; i++ ) {
SMDS_MeshFace* MF;
if(IsForward)
MF = myHelper->AddFace( Nodes2[i], Nodes1[i],
}
else {
- if ( myLayerPositions.size() != nbNodes )
+ if ((int) myLayerPositions.size() != nbNodes )
return error("Radial edge is meshed by other algorithm");
}
}
ok = !aResMap.count( aMesh.GetSubMesh(LinEdge1) );
if ( !ok ) {
const vector<int>& aVec = aResMap[ aMesh.GetSubMesh(LinEdge1) ];
- ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() );
+ ok = ( aVec[SMDSEntity_Node] == (int) myLayerPositions.size() );
}
if(ok) {
ok = algo1d->EvaluateCircularEdge( aMesh, CircEdge, aResMap );
// other curve not line
return error(COMPERR_BAD_SHAPE);
}
- int nbLayers = myLayerPositions.size();
+ size_t nbLayers = myLayerPositions.size();
computeLayerPositions( P0, P1, LinEdge2 );
if ( nbLayers != myLayerPositions.size() )
return error("Different hypotheses apply to radial edges");
ok = true; // override other 1d hyps
else {
const vector<int>& aVec = aResMap[ aMesh.GetSubMesh(LinEdge1) ];
- ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() );
+ ok = ( aVec[SMDSEntity_Node] == (int) myLayerPositions.size() );
}
}
if( ok && aResMap.count( aMesh.GetSubMesh(LinEdge2) )) {
ok = true; // override other 1d hyps
else {
const vector<int>& aVec = aResMap[ aMesh.GetSubMesh(LinEdge2) ];
- ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() );
+ ok = ( aVec[SMDSEntity_Node] == (int) myLayerPositions.size() );
}
}
if(ok) {
if ( !_edgeIDs.empty() )
{
- for ( size_t i = 0; i < _edgeIDs.size(); i++)
+ for ( size_t i = 0; i < _edgeIDs.size(); i++ )
save << " " << _edgeIDs[i];
save << " " << _objEntry << " ";
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
bool isOK;
int intVal;
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_edgeIDs.reserve( intVal );
- for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++ ) {
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
}
return load;
{
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_length = a;
else
{
bool isOK = true;
int intVal;
- isOK = (load >> _begLength);
+ isOK = static_cast<bool>(load >> _begLength);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> _endLength);
+ isOK = static_cast<bool>(load >> _endLength);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_edgeIDs.reserve( intVal );
for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
}
return load;
QwtLegend* legend = dynamic_cast<QwtLegend*>( plotCurve->plot()->legend() );
QWidget* widget = legend->legendWidget( itemInfo );
QwtLegendLabel* label = dynamic_cast<QwtLegendLabel*>( widget );
- if( Plot2d_QwtLegendLabel* anItem = (Plot2d_QwtLegendLabel*)label )
- return anItem;
+ Plot2d_QwtLegendLabel* anItem = (Plot2d_QwtLegendLabel*)label;
+ return anItem;
}
StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h )
-: QwtPlot( p ),
- myPoints( 50 ),
- myIsTable( false ),
- myVars( 1, 1 ),
- myValues( 1, 1 ),
- myConv( CUT_NEGATIVE ),
- myIsDone( true ),
- myNbSeg( 1 )
+ : QwtPlot( p ),
+ myPoints( 50 ),
+ myNbSeg( 1 ),
+ myIsTable( false ),
+ myConv( CUT_NEGATIVE ),
+ myVars( 1, 1 ),
+ myValues( 1, 1 ),
+ myIsDone( true )
{
Kernel_Utils::Localizer loc;
myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h );
setData( const DataArray& array )
{
QList<double> d;
- for ( int i = 0; i < array.length(); i++ )
+ for ( CORBA::ULong i = 0; i < array.length(); i++ )
d.append( array[i] );
sortData( d );
void StdMeshersGUI_FixedPointsParamWdg::SetListOfPoints( SMESH::double_array_var thePoints)
{
clear();
- for ( int i = 0; i < thePoints->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < thePoints->length(); i++ ) {
addPoint( thePoints[ i ] );
}
}
{
if ( myListWidget->count() > 0 && theSegments->length() == 1)
mySameValues->setChecked(true);
- for ( int i = 0; i < theSegments->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < theSegments->length(); i++ ) {
setNbSegments( i, theSegments[i] );
}
}
//================================================================================
/*!
* \brief Constructor initialized by filter
- * \param f - object filter
+ * \param f - object filter
*/
//================================================================================
::StdMeshersGUI_LayerDistributionParamWdg(SMESH::SMESH_Hypothesis_ptr holderHyp,
SMESH::SMESH_Hypothesis_ptr distribHyp,
const QString& name,
- QDialog* dlg):
- QWidget(), myName(name), myDlg( dlg )
+ QDialog* dlg):
+ QWidget(), myDlg( dlg ), myName(name)
{
myHolderHyp = SMESH::SMESH_Hypothesis::_duplicate( holderHyp );
init();
case Regular :
valStr += tr("SMESH_DISTR_REGULAR");
break;
- case Scale :
- valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );\
+ case Scale :
+ valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );
break;
case TabFunc : {
//valStr += tr("SMESH_TAB_FUNC");
bool param = true;
- for( int i=0; i < data.myTable.length(); i++, param = !param ) {
+ for( CORBA::ULong i = 0; i < data.myTable.length(); i++, param = !param ) {
if ( param )
valStr += "[";
valStr += QString::number( data.myTable[ i ]);
--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'ARE_sain_lin_rotated.med'
+crack = 'fissureExtrados.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 12,
+ meshBrep = (0.05, 2.0),
+ rayonPipe = 1.0,
+ lenSegPipe = 1, #9,
+ nbSegRad = 8,
+ nbSegCercle = 20,
+ areteFaceFissure = 1.0)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'ARE_sain_lin_rotated.med'
+crack = 'fissureIntrados.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 14,
+ meshBrep = (0.05, 2.0),
+ rayonPipe = 1.0,
+ lenSegPipe = 1, #9,
+ nbSegRad = 5,
+ nbSegCercle = 16,
+ areteFaceFissure = 1.0)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
# scripts / static
SET(plugin_SCRIPTS
__init__.py
- casStandard.py
exemple.py
exemple2.py
)
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure)
__init__.py
cubeAngle2.py
cubeAngle.py
+ cubeCoin.py
+ cubeMilieu.py
+ cubeTransverse.py
cylindre_2.py
cylindre.py
disquePerce.py
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/CasTests)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/CasTests)
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeCoin',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"),
+ edgeFissIds = [7],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 20)
+
+ # ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeMilieu',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"),
+ edgeFissIds = [7],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+# ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeTransverse',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"),
+ edgeFissIds = [6],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+# ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel, True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# -*- coding: utf-8 -*-
import sys, traceback
+import logging
from blocFissure import gmu
from blocFissure.gmu import initLog
+
+# -----------------------------------------------------------------------------------------------
#initLog.setDebug()
initLog.setVerbose()
+#initLog.setRelease()
+#initLog.setPerfTests()
+
+# ---tous les cas en sequence, ou les cas selectionnés ...
+runall = True
+if runall:
+ torun = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,]
+else: #prob 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
+ torun = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,]
+# -----------------------------------------------------------------------------------------------
from blocFissure.gmu import geomsmesh
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
problemes = []
from blocFissure.CasTests.vis_1 import vis_1
problemes.append(vis_1(cas))
-# ---tous les cas en sequence, ou les cas selectionnés ...
-runall = True
-if runall:
- torun = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,]
-else: #prob 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
- torun = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
+cas=25
+from blocFissure.CasTests import cubeCoin
+problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, cas))
+
+cas=26
+from blocFissure.CasTests import cubeMilieu
+problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, cas))
+
+cas=27
+from blocFissure.CasTests import cubeTransverse
+problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, cas))
+
for i in range(len(problemes)):
if torun[i]:
+ logging.critical("=== Execution cas %s", i)
try:
problemes[i].executeProbleme()
except:
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, [12, 4])
+ geompy.UnionIDs(fondFiss, [14, 9])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 2.5,
rayonPipe = 1.5,
lenSegPipe = 6,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe =2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
- nbsegCercle = 6,
+ nbsegCercle = 8,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 4,
lenSegPipe = 4,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 4,
lenSegPipe = 4,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 8,
rayonPipe = 1,
lenSegPipe = 1.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2,
lenSegPipe = 6,
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, [4, 7, 9])
+ geompy.UnionIDs(fondFiss, [7, 9])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
Exécution des exemples et cas tests :
-------------------------------------
+=====================================
- lancer salome
-- exécuter les instructions suivantes dans la console Python embarquée, ou dans une console Python avec l'environnement SALOME
- # les shapes et fichiers med nécessaires aux tests sont créés dans ${SMESH_ROOT_DIR}/share/salome/plugins/smesh/blocFissure/CasTests
+- exécuter les instructions suivantes dans la console Python embarquée,
+ ou dans une console Python avec l'environnement SALOME (salome shell)
+
+ # les shapes et fichiers med nécessaires aux tests sont créés dans
+ ${SMESH_ROOT_DIR}/lib/python2.7/site-packages/salome/blocFissure/CasTests
+
# les maillages fissurés sont écrits dans le répertoire d'exécution.
-# preparation des shapes et fichiers MED
+# préparation des shapes et fichiers MED
+----------------------------------------
-import sys, os
-sys.path.append(os.path.join(os.environ["SMESH_ROOT_DIR"], "share", "salome", "plugins", "smesh"))
from blocFissure.materielCasTests import genereMateriel
-# execution exemples
+# exécution exemple
+-------------------
-from blocFissure import exemple
from blocFissure import exemple
-# execution des cas tests
+# exécution des cas tests (long: 1/2 heure)
+-------------------------------------------
from blocFissure.CasTests import execution_Cas
+# bug et problèmes des cas tests
+--------------------------------
+
+Mauvaise détection d'arête vive avec GetInPlace : cas 7, 24
+
+Le maillage longitudinal du pipe peut creer des mailles de faible épaisseur
+à une des extrémités : le maillage en triangles des faces de fissure et de peau
+peut être moche au voisinage, de même que les tétraèdres qui s'appuient dessus.
+(2,3,16,26 ?)
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import os
-from blocFissure import gmu
-from blocFissure.gmu.geomsmesh import geompy, smesh
-
-import math
-import GEOM
-import SALOMEDS
-import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
-import logging
-
-from blocFissure.gmu.fissureGenerique import fissureGenerique
-
-from blocFissure.gmu.initEtude import initEtude
-from blocFissure.gmu.triedreBase import triedreBase
-from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
-from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
-
-O, OX, OY, OZ = triedreBase()
-
-class casStandard(fissureGenerique):
- """
- problème de fissure standard, défini par :
- - un maillage sain (hexaèdres),
- - une face géométrique de fissure, qui doit légèrement dépasser hors du volume maillé
- - les numéros d'arêtes (edges géométriques) correspondant au fond de fissure
- - les paramètres de maillage de la fissure
- """
-
- # ---------------------------------------------------------------------------
- def __init__ (self, dicoParams, references = None, numeroCas = 0):
- initEtude()
- self.references = references
- self.dicoParams = dicoParams
- if self.dicoParams.has_key('nomCas'):
- self.nomCas = self.dicoParams['nomCas']
- else:
- self.nomCas = 'casStandard'
- self.numeroCas = numeroCas
- if self.numeroCas != 0:
- self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
- else:
- self.nomProbleme = self.nomCas
- if self.dicoParams.has_key('lenSegPipe'):
- self.lenSegPipe = self.dicoParams['lenSegPipe']
- else:
- self.lenSegPipe =self.dicoParams['rayonPipe']
- if self.dicoParams.has_key('step'):
- step = self.dicoParams['step']
- else:
- step = -1 # exécuter toutes les étapes
- if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
- self.executeProbleme(step)
-
- # ---------------------------------------------------------------------------
- def genereMaillageSain(self, geometriesSaines, meshParams):
- logging.info("genereMaillageSain %s", self.nomCas)
-
- ([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
- smesh.SetName(objetSain.GetMesh(), 'objetSain')
-
- return [objetSain, True] # True : maillage hexa
-
- # ---------------------------------------------------------------------------
- def setParamShapeFissure(self):
- """
- paramètres de la fissure pour méthode insereFissureGenerale
- lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
- rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
- convexe : True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
- pointIn_x : optionnel : coordonnée x d'un point dans le solide sain (pour orienter la face - idem avec y,z)
- """
- logging.info("setParamShapeFissure %s", self.nomCas)
- if self.dicoParams.has_key('pointInterieur'):
- self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
- rayonPipe = self.dicoParams['rayonPipe'],
- lenSegPipe = self.lenSegPipe,
- pointIn_x = self.dicoParams['pointInterieur'][0],
- pointIn_y = self.dicoParams['pointInterieur'][1],
- pointIn_z = self.dicoParams['pointInterieur'][2])
- else:
- self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
- rayonPipe = self.dicoParams['rayonPipe'],
- lenSegPipe = self.lenSegPipe)
-
- # ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
-
- lgInfluence = shapeFissureParams['lgInfluence']
-
- shellFiss = geompy.ImportFile( self.dicoParams['brepFaceFissure'], "BREP")
- fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] )
- geompy.addToStudy( shellFiss, 'shellFiss' )
- geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
-
- centre = None
- return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
-
- # ---------------------------------------------------------------------------
- def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
- nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
- nbsegRad = self.dicoParams['nbSegRad'],
- nbsegCercle = self.dicoParams['nbSegCercle'],
- areteFaceFissure = self.dicoParams['areteFaceFissure'])
-
- # ---------------------------------------------------------------------------
- def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
- elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams)
- return elementsDefaut
-
- # ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
- return maillageFissure
-
- # ---------------------------------------------------------------------------
- def setReferencesMaillageFissure(self):
- if self.references is not None:
- self.referencesMaillageFissure = self.references
- else:
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
- Entity_Quad_Triangle = 0,
- Entity_Quad_Edge = 0,
- Entity_Quad_Penta = 0,
- Entity_Quad_Hexa = 0,
- Entity_Node = 0,
- Entity_Quad_Tetra = 0,
- Entity_Quad_Quadrangle = 0)
-
initLog.setDebug()
#initLog.setVerbose()
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
dicoParams = dict(nomCas = 'angleCube',
maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'),
#initLog.setDebug()
initLog.setVerbose()
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
dicoParams = dict(nomCas = 'angleCube2',
maillageSain = 'boite.med',
brepFaceFissure = "disk.brep",
edgeFissIds = [4],
- lgInfluence = 20,
+ lgInfluence = 50,
meshBrep = (5,10),
- rayonPipe = 10,
+ rayonPipe = 15,
+ lenSegPipe = 20,
nbSegRad = 5,
- nbSegCercle = 8,
- areteFaceFissure = 10)
+ nbSegCercle = 12,
+ areteFaceFissure = 2)
execInstance = casStandard(dicoParams)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'maillageSainTuyauFEM.med'
+crack = 'fissureQuartEllipse.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(crack),
+ edgeFissIds = [9],
+ lgInfluence = 250,
+ meshBrep = (10, 50),
+ rayonPipe = 35,
+ lenSegPipe = 7, #9,
+ nbSegRad = 6,
+ nbSegCercle = 30,
+ areteFaceFissure = 20)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
\ No newline at end of file
# scripts / static
SET(plugin_SCRIPTS
__init__.py
+ ajustePointsEdgePipeFissure.py
blocDefaut.py
+ calculePointsAxiauxPipe.py
+ casStandard.py
checkDecoupePartition.py
commonSubShapes.py
+ compoundFromList.py
+ construitEdgesRadialesDebouchantes.py
+ construitFissureGenerale.py
+ construitMaillagePipe.py
+ construitPartitionsPeauFissure.py
+ creePointsPipePeau.py
creeZoneDefautDansObjetSain.py
creeZoneDefautFilling.py
creeZoneDefautGeom.py
creeZoneDefautMaillage.py
distance2.py
eliminateDoubles.py
+ elimineExtremitesPipe.py
ellipsoideDefaut.py
enleveDefaut.py
extractionOrienteeMulti.py
findWireIntermediateVertices.py
fissureCoude.py
fissureGenerique.py
+ fusionMaillageAttributionDefaut.py
genereElemsFissureElliptique.py
genereMeshCalculZoneDefaut.py
geomsmesh.py
getCentreFondFiss.py
getStatsMaillageFissure.py
getSubshapeIds.py
+ identifieEdgesPeau.py
+ identifieElementsDebouchants.py
+ identifieElementsFissure.py
+ identifieElementsGeometriquesPeau.py
+ identifieFacesEdgesFissureExterne.py
+ identifieFacesPeau.py
initEtude.py
initLog.py
insereFissureElliptique.py
insereFissureGenerale.py
insereFissureLongue.py
+ listOfExtraFunctions.py
+ mailleAretesEtJonction.py
+ mailleFacesFissure.py
+ mailleFacesPeau.py
meshBlocPart.py
orderEdgesFromWire.py
partitionBlocDefaut.py
+ partitionneFissureParPipe.py
partitionVolumeSain.py
peauInterne.py
produitMixte.py
prolongeWire.py
propagateTore.py
putName.py
+ quadranglesToShapeNoCorner.py
quadranglesToShape.py
+ quadranglesToShapeWithCorner.py
regroupeSainEtDefaut.py
+ restreintFaceFissure.py
rotTrans.py
shapesSurFissure.py
shapeSurFissure.py
testgmu.py
toreFissure.py
triedreBase.py
+ trouveEdgesFissPeau.py
whichSideMulti.py
whichSide.py
whichSideVertex.py
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/gmu)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/gmu)
import os
import initLog
-#initLog.setDebug()
-#initLog.setVerbose()
-#initLog.setRelease()
# --- calcul path blocFissure
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from findWireIntermediateVertices import findWireIntermediateVertices
+from projettePointSurCourbe import projettePointSurCourbe
+
+def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim):
+ """
+ ajustement precis des points sur edgesPipeFissureExterneC
+ """
+ logging.info('start')
+
+ edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
+ verticesPFE = findWireIntermediateVertices(wirePipeFissureExterne) # vertices intermédiaires (des points en trop dans ptsInWireFissExtPipe)
+ idiskmin = idisklim[0] + 1 # on ne prend pas le disque sur la peau, déjà ajusté
+ idiskmax = idisklim[1] # on ne prend pas le disque sur la peau, déjà ajusté
+ idiskint = []
+ for vtx in verticesPFE:
+ distPtVt = []
+ for idisk in range(idiskmin, idiskmax):
+ gptdsk = gptsdisks[idisk]
+ pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
+ distPtVt.append((geompy.MinDistance(pt, vtx), idisk))
+ distPtVt.sort()
+ idiskint.append(distPtVt[0][1])
+ gptsdisks[idiskint[-1]][0][-1] = vtx
+ logging.debug("ajustement point sur edgePipeFissureExterne, vertex: %s %s", idiskint[-1], distPtVt[0][0])
+ for idisk in range(idiskmin, idiskmax):
+ if idisk in idiskint:
+ break
+ logging.debug("ajustement point sur edgePipeFissureExterne: %s", idisk)
+ gptdsk = gptsdisks[idisk]
+ pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
+ distPtEd = [(geompy.MinDistance(pt, edgePFE), k, edgePFE) for k, edgePFE in enumerate(edgesPFE)]
+ distPtEd.sort()
+ edgePFE = distPtEd[0][2]
+ u = projettePointSurCourbe(pt, edgePFE)
+ ptproj = geompy.MakeVertexOnCurve(edgePFE, u)
+ gptsdisks[idisk][0][-1] = ptproj
+
+ return gptsdisks
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+import math
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+
+def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
+ centreFondFiss, wireFondFiss, wirePipeFiss,
+ lenSegPipe, rayonPipe, nbsegCercle, nbsegRad):
+ """
+ preparation maillage du pipe :
+ - détections des points a respecter : jonction des edges/faces constituant
+ la face de fissure externe au pipe
+ - points sur les edges de fond de fissure et edges pipe/face fissure,
+ - vecteurs tangents au fond de fissure (normal au disque maillé)
+ """
+
+ logging.info('start')
+
+ # --- option de maillage selon le rayon de courbure du fond de fissure
+ lenEdgeFondExt = 0
+ for edff in edgesFondFiss:
+ lenEdgeFondExt += geompy.BasicProperties(edff)[0]
+
+ disfond = []
+ for filling in facesDefaut:
+ disfond.append(geompy.MinDistance(centreFondFiss, filling))
+ disfond.sort()
+ rcourb = disfond[0]
+ nbSegQuart = 5 # on veut 5 segments min sur un quart de cercle
+ alpha = math.pi/(4*nbSegQuart)
+ deflexion = rcourb*(1.0 -math.cos(alpha))
+ lgmin = lenSegPipe*0.25
+ lgmax = lenSegPipe*1.5
+ logging.debug("rcourb: %s, lenFond:%s, deflexion: %s, lgmin: %s, lgmax: %s", rcourb, lenEdgeFondExt, deflexion, lgmin, lgmax)
+
+ meshFondExt = smesh.Mesh(wireFondFiss)
+ algo1d = meshFondExt.Segment()
+ hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure
+ isDone = meshFondExt.Compute()
+
+ ptGSdic = {} # dictionnaire [paramètre sur la courbe] --> point géométrique
+ allNodeIds = meshFondExt.GetNodesId()
+ for nodeId in allNodeIds:
+ xyz = meshFondExt.GetNodeXYZ(nodeId)
+ #logging.debug("nodeId %s, coords %s", nodeId, str(xyz))
+ pt = geompy.MakeVertex(xyz[0], xyz[1], xyz[2])
+ u, PointOnEdge, EdgeInWireIndex = geompy.MakeProjectionOnWire(pt, wireFondFiss) # u compris entre 0 et 1
+ edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
+ ptGSdic[(edgeOrder, EdgeInWireIndex, u)] = pt
+ #logging.debug("nodeId %s, u %s", nodeId, str(u))
+ usort = sorted(ptGSdic)
+ logging.debug("nombre de points obtenus par deflexion %s",len(usort))
+
+ centres = []
+ origins = []
+ normals = []
+ for edu in usort:
+ ied = edu[1]
+ u = edu[2]
+ vertcx = ptGSdic[edu]
+ norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], u)
+ plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe)
+ part = geompy.MakePartition([plan], [wirePipeFiss], [], [], geompy.ShapeType["VERTEX"], 0, [], 0)
+ liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
+ if len(liste) == 5: # 4 coins du plan plus intersection recherchée
+ for point in liste:
+ if geompy.MinDistance(point, vertcx) < 1.1*rayonPipe: # les quatre coins sont plus loin
+ vertpx = point
+ break
+ centres.append(vertcx)
+ origins.append(vertpx)
+ normals.append(norm)
+# name = "vertcx%d"%i
+# geompy.addToStudyInFather(wireFondFiss, vertcx, name)
+# name = "vertpx%d"%i
+# geompy.addToStudyInFather(wireFondFiss, vertpx, name)
+# name = "plan%d"%i
+# geompy.addToStudyInFather(wireFondFiss, plan, name)
+
+ # --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau
+
+ logging.debug("nbsegCercle %s", nbsegCercle)
+
+ # -----------------------------------------------------------------------
+ # --- points géométriques
+
+ gptsdisks = [] # vertices géométrie de tous les disques
+ raydisks = [[] for i in range(nbsegCercle)]
+ for i in range(len(centres)): # boucle sur les disques
+ gptdsk = [] # vertices géométrie d'un disque
+ vertcx = centres[i]
+ vertpx = origins[i]
+ normal = normals[i]
+ vec1 = geompy.MakeVector(vertcx, vertpx)
+
+ points = [vertcx] # les points du rayon de référence
+ for j in range(nbsegRad):
+ pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*float(rayonPipe)/nbsegRad)
+ points.append(pt)
+ gptdsk.append(points)
+ pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
+ rayon = geompy.MakeLineTwoPnt(vertcx, pt)
+ raydisks[0].append(rayon)
+
+ for k in range(nbsegCercle-1):
+ angle = (k+1)*2*math.pi/nbsegCercle
+ pts = [vertcx] # les points d'un rayon obtenu par rotation
+ for j in range(nbsegRad):
+ pt = geompy.MakeRotation(points[j+1], normal, angle)
+ pts.append(pt)
+ gptdsk.append(pts)
+ ray = geompy.MakeRotation(rayon, normal, angle)
+ raydisks[k+1].append(ray)
+
+ gptsdisks.append(gptdsk)
+
+ return (centres, gptsdisks, raydisks)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from geomsmesh import geompy, smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+import math
+import GEOM
+import SALOMEDS
+import SMESH
+#import StdMeshers
+#import GHS3DPlugin
+#import NETGENPlugin
+import logging
+
+from fissureGenerique import fissureGenerique
+
+from initEtude import initEtude
+from triedreBase import triedreBase
+from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
+from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
+from construitFissureGenerale import construitFissureGenerale
+
+O, OX, OY, OZ = triedreBase()
+
+class casStandard(fissureGenerique):
+ """
+ problème de fissure standard, défini par :
+ - un maillage sain (hexaèdres),
+ - une face géométrique de fissure, qui doit légèrement dépasser hors du volume maillé
+ - les numéros d'arêtes (edges géométriques) correspondant au fond de fissure
+ - les paramètres de maillage de la fissure
+ """
+
+ # ---------------------------------------------------------------------------
+ def __init__ (self, dicoParams, references = None, numeroCas = 0):
+ initEtude()
+ self.references = references
+ self.dicoParams = dicoParams
+ if self.dicoParams.has_key('nomCas'):
+ self.nomCas = self.dicoParams['nomCas']
+ else:
+ self.nomCas = 'casStandard'
+ self.numeroCas = numeroCas
+ if self.numeroCas != 0:
+ self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
+ else:
+ self.nomProbleme = self.nomCas
+ if self.dicoParams.has_key('lenSegPipe'):
+ self.lenSegPipe = self.dicoParams['lenSegPipe']
+ else:
+ self.lenSegPipe =self.dicoParams['rayonPipe']
+ if self.dicoParams.has_key('step'):
+ step = self.dicoParams['step']
+ else:
+ step = -1 # exécuter toutes les étapes
+ if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
+ self.executeProbleme(step)
+
+ # ---------------------------------------------------------------------------
+ def genereMaillageSain(self, geometriesSaines, meshParams):
+ logging.info("genereMaillageSain %s", self.nomCas)
+
+ ([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
+ smesh.SetName(objetSain.GetMesh(), 'objetSain')
+
+ return [objetSain, True] # True : maillage hexa
+
+ # ---------------------------------------------------------------------------
+ def setParamShapeFissure(self):
+ """
+ paramètres de la fissure pour méthode insereFissureGenerale
+ lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
+ rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
+ convexe : True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
+ pointIn_x : optionnel : coordonnée x d'un point dans le solide sain (pour orienter la face - idem avec y,z)
+ """
+ logging.info("setParamShapeFissure %s", self.nomCas)
+ if self.dicoParams.has_key('pointInterieur'):
+ self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
+ rayonPipe = self.dicoParams['rayonPipe'],
+ lenSegPipe = self.lenSegPipe,
+ pointIn_x = self.dicoParams['pointInterieur'][0],
+ pointIn_y = self.dicoParams['pointInterieur'][1],
+ pointIn_z = self.dicoParams['pointInterieur'][2])
+ else:
+ self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
+ rayonPipe = self.dicoParams['rayonPipe'],
+ lenSegPipe = self.lenSegPipe)
+
+ # ---------------------------------------------------------------------------
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ logging.info("genereShapeFissure %s", self.nomCas)
+
+ lgInfluence = shapeFissureParams['lgInfluence']
+
+ shellFiss = geompy.ImportFile( self.dicoParams['brepFaceFissure'], "BREP")
+ fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
+ geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] )
+ geomPublish(initLog.debug, shellFiss, 'shellFiss' )
+ geomPublishInFather(initLog.debug, shellFiss, fondFiss, 'fondFiss' )
+
+
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
+
+ centre = None
+ return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
+
+ # ---------------------------------------------------------------------------
+ def setParamMaillageFissure(self):
+ self.maillageFissureParams = dict(nomRep = '.',
+ nomFicSain = self.nomCas,
+ nomFicFissure = 'fissure_' + self.nomCas,
+ nbsegRad = self.dicoParams['nbSegRad'],
+ nbsegCercle = self.dicoParams['nbSegCercle'],
+ areteFaceFissure = self.dicoParams['areteFaceFissure'])
+
+ # ---------------------------------------------------------------------------
+ def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
+ elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams)
+ return elementsDefaut
+
+ # ---------------------------------------------------------------------------
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step):
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
+ return maillageFissure
+
+ # ---------------------------------------------------------------------------
+ def setReferencesMaillageFissure(self):
+ if self.references is not None:
+ self.referencesMaillageFissure = self.references
+ else:
+ self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def compoundFromList(elements, nom=None):
+ """
+
+ """
+ logging.debug('start')
+
+ shapeList = []
+ for a in elements:
+ if not isinstance(a, list):
+ shapeList.append(a)
+ else:
+ if a[0] is not None:
+ shapeList.append(a[0])
+
+ if nom is not None:
+ for i,a in enumerate(shapeList):
+ nomi = nom +"%d"%i
+ logging.debug('nom: %s',nomi)
+ geomPublish(initLog.debug, a, nomi)
+
+ shapeCompound = None
+ if len(shapeList) > 0:
+ shapeCompound =geompy.MakeCompound(shapeList)
+ nomc = "compound_%s"%nom
+ geomPublish(initLog.debug, shapeCompound, nomc)
+ return shapeCompound
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+from sortEdges import sortEdges
+
+def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
+ facesPipePeau, edgeRadFacePipePeau, nbsegCercle):
+ """
+ construction des listes d'edges radiales sur chaque extrémité débouchante
+ """
+ logging.info('start')
+
+ # --- listes de nappes radiales en filling à chaque extrémité débouchante
+
+ facesDebouchantes = [False, False]
+ idFacesDebouchantes = [-1, -1] # contiendra les indices des faces disque débouchantes (facesPipePeau)
+ listNappes =[]
+ for i, idisk in enumerate(idisklim):
+ numout = idiskout[i]
+ logging.debug("extremité %s, indices disques interne %s, externe %s",i, idisk, numout)
+ nappes = []
+ if (idisk != 0) and (idisk != len(gptsdisks)-1): # si extrémité débouchante
+ for k in range(nbsegCercle):
+ if i == 0:
+ iddeb = max(0, numout)
+ idfin = max(iddeb+3,idisk+1) # il faut 3 rayons pour faire un filling qui suive le fond de fissure
+ #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb)
+ comp = geompy.MakeCompound(raydisks[k][iddeb:idfin])
+ name='compoundRay%d'%k
+ geomPublish(initLog.debug, comp, name)
+ else:
+ idfin = min(len(gptsdisks), numout+1)
+ iddeb = min(idfin-3, idisk) # il faut 3 rayons pour faire un filling qui suive le fond de fissure
+ #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb)
+ comp = geompy.MakeCompound(raydisks[k][iddeb:idfin])
+ name='compoundRay%d'%k
+ geomPublish(initLog.debug, comp, name)
+ nappe = geompy.MakeFilling(comp, 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default)
+ nappes.append(nappe)
+ name='nappe%d'%k
+ geomPublish(initLog.debug, nappe, name)
+ facesDebouchantes[i] = True
+ listNappes.append(nappes)
+
+ # --- mise en correspondance avec les indices des faces disque débouchantes (facesPipePeau)
+ for i, nappes in enumerate(listNappes):
+ if facesDebouchantes[i]:
+ for k, face in enumerate(facesPipePeau):
+ #logging.debug('i, k, face, nappes[0] %s %s %s %s', i, k, face, nappes[0])
+ #geomPublish(initLog.debug, nappes[0], 'lanappe')
+ #geomPublish(initLog.debug, face, 'laface')
+ edge = geompy.MakeSection(face, nappes[0])
+ if geompy.NbShapes(edge, geompy.ShapeType["EDGE"]) > 0:
+ idFacesDebouchantes[i] = k
+ break
+ logging.debug("idFacesDebouchantes: %s", idFacesDebouchantes)
+
+ # --- construction des listes d'edges radiales sur chaque extrémité débouchante
+ listEdges = []
+ for i, nappes in enumerate(listNappes):
+ ifd = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
+ if ifd < 0:
+ listEdges.append([])
+ else:
+ face = facesPipePeau[ifd]
+ edges = [edgeRadFacePipePeau[ifd]]
+ for k, nappe in enumerate(nappes):
+ if k > 0:
+ obj = geompy.MakeSection(face, nappes[k]) # normalement une edge, parfois un compound d'edges dont un tout petit
+ edge = obj
+ vs = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
+ if len(vs) > 2:
+ eds = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
+ [edsorted, minl,maxl] = sortEdges(eds)
+ edge = edsorted[-1]
+ else:
+ maxl = geompy.BasicProperties(edge)[0]
+ if maxl < 0.01: # problème MakeSection
+ logging.debug("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl)
+ partNappeFace = geompy.MakePartition([face, nappes[k]], [] , [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ edps= geompy.ExtractShapes(partNappeFace, geompy.ShapeType["EDGE"], False)
+ ednouv = []
+ for ii, ed in enumerate(edps):
+ vxs = geompy.ExtractShapes(ed, geompy.ShapeType["VERTEX"], False)
+ distx = [geompy.MinDistance(vx, face) for vx in vxs]
+ distx += [geompy.MinDistance(vx, nappes[k]) for vx in vxs]
+ dmax = max(distx)
+ logging.debug(" dmax %s",dmax)
+ if dmax < 0.01:
+ ednouv.append(ed)
+ logging.debug(" edges issues de la partition: %s", ednouv)
+ for ii, ed in enumerate(ednouv):
+ geomPublish(initLog.debug, ed, "ednouv%d"%ii)
+ [edsorted, minl,maxl] = sortEdges(ednouv)
+ logging.debug(" longueur edge trouvée: %s", maxl)
+ edge = edsorted[-1]
+ edges.append(edge)
+ name = 'edgeEndPipe%d'%k
+ geomPublish(initLog.debug, edge, name)
+ listEdges.append(edges)
+
+ return (listEdges, idFacesDebouchantes)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+import salome
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+from geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+import math
+import bisect
+
+# from extractionOrientee import extractionOrientee
+# from extractionOrienteeMulti import extractionOrienteeMulti
+# from sortFaces import sortFaces
+#from sortEdges import sortEdges
+# from eliminateDoubles import eliminateDoubles
+# from substractSubShapes import substractSubShapes
+# from produitMixte import produitMixte
+# from findWireEndVertices import findWireEndVertices
+#from findWireIntermediateVertices import findWireIntermediateVertices
+from orderEdgesFromWire import orderEdgesFromWire
+# from getSubshapeIds import getSubshapeIds
+from putName import putName
+# from distance2 import distance2
+from enleveDefaut import enleveDefaut
+from shapeSurFissure import shapeSurFissure
+from regroupeSainEtDefaut import RegroupeSainEtDefaut
+from triedreBase import triedreBase
+# from checkDecoupePartition import checkDecoupePartition
+# from whichSide import whichSide
+# from whichSideMulti import whichSideMulti
+#from whichSideVertex import whichSideVertex
+#from projettePointSurCourbe import projettePointSurCourbe
+# from prolongeWire import prolongeWire
+from restreintFaceFissure import restreintFaceFissure
+from partitionneFissureParPipe import partitionneFissureParPipe
+from construitPartitionsPeauFissure import construitPartitionsPeauFissure
+from compoundFromList import compoundFromList
+from identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
+from identifieFacesEdgesFissureExterne import identifieFacesEdgesFissureExterne
+from calculePointsAxiauxPipe import calculePointsAxiauxPipe
+from elimineExtremitesPipe import elimineExtremitesPipe
+from construitEdgesRadialesDebouchantes import construitEdgesRadialesDebouchantes
+from creePointsPipePeau import creePointsPipePeau
+from ajustePointsEdgePipeFissure import ajustePointsEdgePipeFissure
+from construitMaillagePipe import construitMaillagePipe
+from mailleAretesEtJonction import mailleAretesEtJonction
+from mailleFacesFissure import mailleFacesFissure
+from mailleFacesPeau import mailleFacesPeau
+
+# -----------------------------------------------------------------------------
+# --- procédure complète fissure générale
+
+def construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step=-1):
+ """
+ TODO: a completer
+ """
+ logging.info('start')
+
+ shapeDefaut = shapesFissure[0] # faces de fissure, débordant
+ fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
+
+ rayonPipe = shapeFissureParams['rayonPipe']
+ if shapeFissureParams.has_key('lenSegPipe'):
+ lenSegPipe = shapeFissureParams['lenSegPipe']
+ else:
+ lenSegPipe = rayonPipe
+
+ nomRep = maillageFissureParams['nomRep']
+ nomFicSain = maillageFissureParams['nomFicSain']
+ nomFicFissure = maillageFissureParams['nomFicFissure']
+
+ nbsegRad = maillageFissureParams['nbsegRad'] # nombre de couches selon un rayon du pipe
+ nbsegCercle = maillageFissureParams['nbsegCercle'] # nombre de secteur dans un cercle du pipe
+ areteFaceFissure = maillageFissureParams['areteFaceFissure']
+
+ pointIn_x = 0.0
+ pointIn_y = 0.0
+ pointIn_z = 0.0
+ isPointInterne = False
+ if shapeFissureParams.has_key('pointIn_x'):
+ pointIn_x = shapeFissureParams['pointIn_x']
+ isPointInterne = True
+ if shapeFissureParams.has_key('pointIn_y'):
+ pointIn_y = shapeFissureParams['pointIn_y']
+ isPointInterne = True
+ if shapeFissureParams.has_key('pointIn_z'):
+ pointIn_z = shapeFissureParams['pointIn_z']
+ isPointInterne = True
+ if isPointInterne:
+ pointInterne = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
+ else:
+ pointInterne = None
+
+ #fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
+ fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
+
+ # fillings des faces en peau
+ facesDefaut = elementsDefaut[0]
+ #centresDefaut = elementsDefaut[1]
+ #normalsDefaut = elementsDefaut[2]
+ #extrusionsDefaut = elementsDefaut[3]
+ dmoyen = elementsDefaut[4]
+ bordsPartages = elementsDefaut[5]
+ #fillconts = elementsDefaut[6]
+ #idFilToCont = elementsDefaut[7]
+ maillageSain = elementsDefaut[8]
+ internalBoundary = elementsDefaut[9]
+ zoneDefaut = elementsDefaut[10]
+ zoneDefaut_skin = elementsDefaut[11]
+ zoneDefaut_internalFaces = elementsDefaut[12]
+ zoneDefaut_internalEdges = elementsDefaut[13]
+ #edgeFondExt = elementsDefaut[14]
+ centreFondFiss = elementsDefaut[15]
+ #tgtCentre = elementsDefaut[16]
+
+ O, OX, OY, OZ = triedreBase()
+
+ # --- restriction de la face de fissure au domaine solide :
+ # partition face fissure étendue par fillings, on garde la face interne
+
+ facesPortFissure = restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne)
+
+ # --- pipe de fond de fissure, prolongé, partition face fissure par pipe
+ # identification des edges communes pipe et face fissure
+
+ (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss) = partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe)
+ edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss)
+ for i,edge in enumerate(edgesFondFiss):
+ geomPublishInFather(initLog.debug, wireFondFiss, edge, "edgeFondFiss%d"%i)
+
+ # --- peau et face de fissure
+ #
+ # --- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée
+ # il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
+ # liste de faces externes : facesDefaut
+ # liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
+
+ partitionsPeauFissFond = construitPartitionsPeauFissure(facesDefaut, fissPipe)
+
+ # --- arêtes vives détectées (dans quadranglesToShapeNoCorner
+ # et quadranglesToShapeWithCorner)
+
+ aretesVivesC = compoundFromList(bordsPartages, "areteVive")
+ aretesVivesCoupees = [] # ensembles des arêtes vives identifiées sur les faces de peau dans l'itération sur partitionsPeauFissFond
+
+ # --- inventaire des faces de peau coupées par la fissure
+ # pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
+ # 0, 1 ou plus edges de la face de fissure externe au pipe
+
+ nbFacesFilling = len(partitionsPeauFissFond)
+
+ ptEdgeFond = [ [] for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe]
+ fsPipePeau = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes]
+ edRadFPiPo = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge radiale des faces du pipe débouchantes ]
+ fsFissuExt = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces de fissure externes au pipe]
+ edFisExtPe = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
+ edFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes]
+ facesPeaux = [None for i in range(nbFacesFilling)] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
+ edCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
+ ptCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ gpedgeBord = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ gpedgeVifs = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupes subshape des edges aux arêtes vives entre fillings
+ edFissPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
+
+ for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
+ if partitionPeauFissFond is not None:
+ dataPPFF,aretesVivesCoupees = identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
+ edgesFondFiss, wireFondFiss, aretesVivesC,
+ facesDefaut, centreFondFiss, rayonPipe,
+ aretesVivesCoupees)
+ ptEdgeFond[ifil] = dataPPFF['endsEdgeFond']
+ fsPipePeau[ifil] = dataPPFF['facesPipePeau']
+ edRadFPiPo[ifil] = dataPPFF['edgeRadFacePipePeau']
+ fsFissuExt[ifil] = dataPPFF['facesFissExt']
+ edFisExtPe[ifil] = dataPPFF['edgesFissExtPeau']
+ edFisExtPi[ifil] = dataPPFF['edgesFissExtPipe']
+ facesPeaux[ifil] = dataPPFF['facePeau']
+ edCircPeau[ifil] = dataPPFF['edgesCircPeau']
+ ptCircPeau[ifil] = dataPPFF['verticesCircPeau']
+ gpedgeBord[ifil] = dataPPFF['groupEdgesBordPeau']
+ gpedgeVifs[ifil] = dataPPFF['bordsVifs']
+ edFissPeau[ifil] = dataPPFF['edgesFissurePeau']
+ ptFisExtPi[ifil] = dataPPFF['verticesPipePeau']
+
+ facesPipePeau = []
+ edgeRadFacePipePeau = []
+ for ifil in range(nbFacesFilling):
+ facesPipePeau += fsPipePeau[ifil]
+ edgeRadFacePipePeau += edRadFPiPo[ifil]
+
+ for i, avc in enumerate(aretesVivesCoupees):
+ name = "areteViveCoupee%d"%i
+ geomPublish(initLog.debug, avc, name)
+
+ # --- identification des faces et edges de fissure externe pour maillage
+
+ (faceFissureExterne, edgesPipeFissureExterneC,
+ wirePipeFissureExterne, edgesPeauFissureExterneC) = identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe,
+ edFisExtPi, edgesPipeFiss)
+
+ # --- preparation maillage du pipe :
+ # - détections des points a respecter : jonction des edges/faces constituant la face de fissure externe au pipe
+ # - points sur les edges de fond de fissure et edges pipe/face fissure,
+ # - vecteurs tangents au fond de fissure (normal au disque maillé)
+
+ (centres, gptsdisks, raydisks) = calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
+ centreFondFiss, wireFondFiss, wirePipeFiss,
+ lenSegPipe, rayonPipe, nbsegCercle, nbsegRad)
+
+ # --- recherche des points en trop (externes au volume à remailler)
+ # - on associe chaque extrémité du pipe à une face filling
+ # - on part des disques aux extrémités du pipe
+ # - pour chaque disque, on prend les vertices de géométrie,
+ # on marque leur position relative à la face.
+ # - on s'arrete quand tous les noeuds sont dedans
+
+ (idFillingFromBout, idisklim, idiskout) = elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle)
+
+ # --- construction des listes d'edges radiales sur chaque extrémité débouchante
+
+ (listEdges, idFacesDebouchantes) = construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
+ facesPipePeau, edgeRadFacePipePeau, nbsegCercle)
+
+ # --- création des points du maillage du pipe sur la face de peau
+
+ (gptsdisks, idisklim) = creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
+ ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad)
+
+ # --- ajustement precis des points sur edgesPipeFissureExterneC
+
+ gptsdisks = ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim)
+
+ # --- maillage effectif du pipe
+
+ (meshPipe, meshPipeGroups, edgesCircPipeGroup) = construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad)
+
+ # --- edges de bord, faces défaut à respecter
+
+ (internalBoundary, bordsLibres, grpAretesVives) = mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, dmoyen)
+
+ # --- maillage faces de fissure
+
+ (meshFaceFiss, grpFaceFissureExterne,
+ grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne) = mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
+ meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad)
+
+ # --- maillage faces de peau
+
+ meshesFacesPeau = mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
+ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
+ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad)
+
+ # --- regroupement des maillages du défaut
+
+ listMeshes = [internalBoundary.GetMesh(),
+ meshPipe.GetMesh(),
+ meshFaceFiss.GetMesh()]
+ for mp in meshesFacesPeau:
+ listMeshes.append(mp.GetMesh())
+
+ meshBoiteDefaut = smesh.Concatenate(listMeshes, 1, 1, 1e-05,False)
+ # pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
+ # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
+ group_faceFissOutPipe = None
+ group_faceFissInPipe = None
+ groups = meshBoiteDefaut.GetGroups()
+ for grp in groups:
+ if grp.GetType() == SMESH.FACE:
+ if grp.GetName() == "fisOutPi":
+ group_faceFissOutPipe = grp
+ elif grp.GetName() == "fisInPi":
+ group_faceFissInPipe = grp
+
+ # le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D
+ distene=True
+ if distene:
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D)
+ else:
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
+ hypo3d = algo3d.MaxElementVolume(1000.0)
+ putName(algo3d.GetSubMesh(), "boiteDefaut")
+ putName(algo3d, "algo3d_boiteDefaut")
+ isDone = meshBoiteDefaut.Compute()
+ putName(meshBoiteDefaut, "boiteDefaut")
+ logging.info("meshBoiteDefaut fini")
+
+ faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' )
+ maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
+ zoneDefaut_internalFaces, zoneDefaut_internalEdges)
+ putName(maillageSain, nomFicSain+"_coupe")
+ extrusionFaceFissure, normfiss = shapeSurFissure(facesPortFissure)
+ maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut,
+ None, None, 'COMPLET', normfiss)
+
+ logging.info("conversion quadratique")
+ maillageComplet.ConvertToQuadratic( 1 )
+ logging.info("groupes")
+ groups = maillageComplet.GetGroups()
+ grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS']
+ fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' )
+
+ logging.info("réorientation face de fissure FACE1")
+ grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
+ nb = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1))
+
+ logging.info("réorientation face de fissure FACE2")
+ plansim = geompy.MakePlane(O, normfiss, 10000)
+ fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim)
+ grps = [ grp for grp in groups if grp.GetName() == 'FACE2']
+ nb = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1))
+ fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
+
+ logging.info("export maillage fini")
+ maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 )
+ putName(maillageComplet, nomFicFissure)
+ logging.info("fichier maillage fissure %s", fichierMaillageFissure)
+
+ if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+
+ logging.info("maillage fissure fini")
+
+ return maillageComplet
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+import SMESH
+
+def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
+ """
+ maillage effectif du pipe
+ """
+ logging.info('start')
+ meshPipe = smesh.Mesh(None, "meshPipe")
+ fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
+ nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis")
+ faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi")
+ edgeFaceFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeFaceFiss")
+ edgeCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe0")
+ edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1")
+ faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0")
+ faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1")
+
+ mptsdisks = [] # vertices maillage de tous les disques
+ mEdges = [] # identifiants edges maillage fond de fissure
+ mEdgeFaces = [] # identifiants edges maillage edge face de fissure externe
+ mFaces = [] # identifiants faces maillage fissure
+ mVols = [] # identifiants volumes maillage pipe
+
+ mptdsk = None
+ for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes
+
+ # -----------------------------------------------------------------------
+ # --- points
+
+ gptdsk = gptsdisks[idisk]
+ if idisk > idisklim[0]:
+ oldmpts = mptdsk
+ mptdsk = [] # vertices maillage d'un disque
+ for k in range(nbsegCercle):
+ points = gptdsk[k]
+ mptids = []
+ for j, pt in enumerate(points):
+ if j == 0 and k > 0:
+ id = mptdsk[0][0]
+ else:
+ coords = geompy.PointCoordinates(pt)
+ id = meshPipe.AddNode(coords[0], coords[1], coords[2])
+ mptids.append(id)
+ mptdsk.append(mptids)
+ mptsdisks.append(mptdsk)
+
+ # -----------------------------------------------------------------------
+ # --- groupes edges cercles debouchants
+
+ if idisk == idisklim[0]:
+ pts = []
+ for k in range(nbsegCercle):
+ pts.append(mptdsk[k][-1])
+ edges = []
+ for k in range(len(pts)):
+ k1 = (k+1)%len(pts)
+ idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
+ edges.append(idEdge)
+ edgeCircPipe0Group.Add(edges)
+
+ if idisk == idisklim[1]:
+ pts = []
+ for k in range(nbsegCercle):
+ pts.append(mptdsk[k][-1])
+ edges = []
+ for k in range(len(pts)):
+ k1 = (k+1)%len(pts)
+ idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
+ edges.append(idEdge)
+ edgeCircPipe1Group.Add(edges)
+
+ # -----------------------------------------------------------------------
+ # --- groupes faces debouchantes
+
+ if idisk == idisklim[0]:
+ faces = []
+ for j in range(nbsegRad):
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle
+ else:
+ idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
+ faces.append(idf)
+ faceCircPipe0Group.Add(faces)
+
+ if idisk == idisklim[1]:
+ faces = []
+ for j in range(nbsegRad):
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle
+ else:
+ idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
+ faces.append(idf)
+ faceCircPipe1Group.Add(faces)
+
+ # -----------------------------------------------------------------------
+ # --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure
+
+ if idisk == idisklim[0]:
+ mEdges.append(0)
+ mEdgeFaces.append(0)
+ mFaces.append([0])
+ mVols.append([[0]])
+ nodesFondFissGroup.Add([mptdsk[0][0]])
+ else:
+ ide = meshPipe.AddEdge([oldmpts[0][0], mptdsk[0][0]])
+ mEdges.append(ide)
+ fondFissGroup.Add([ide])
+ nodesFondFissGroup.Add([mptdsk[0][0]])
+ ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]])
+ mEdgeFaces.append(ide2)
+ edgeFaceFissGroup.Add([ide2])
+ idFaces = []
+ idVols = []
+
+ for j in range(nbsegRad):
+ idf = meshPipe.AddFace([oldmpts[0][j], mptdsk[0][j], mptdsk[0][j+1], oldmpts[0][j+1]])
+ faceFissGroup.Add([idf])
+ idFaces.append(idf)
+
+ idVolCercle = []
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1],
+ oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1]])
+ else:
+ idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j],
+ oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1], oldmpts[k1][j]])
+ idVolCercle.append(idv)
+ idVols.append(idVolCercle)
+
+ mFaces.append(idFaces)
+ mVols.append(idVols)
+
+ pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' )
+ nbAdd = pipeFissGroup.AddFrom( meshPipe.GetMesh() )
+
+ nb, new_mesh, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
+ edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
+
+ meshPipeGroups = dict(fondFissGroup = fondFissGroup,
+ nodesFondFissGroup = nodesFondFissGroup,
+ faceFissGroup = faceFissGroup,
+ edgeFaceFissGroup = edgeFaceFissGroup,
+ edgeCircPipe0Group = edgeCircPipe0Group,
+ edgeCircPipe1Group = edgeCircPipe1Group,
+ faceCircPipe0Group = faceCircPipe0Group,
+ faceCircPipe1Group = faceCircPipe1Group,
+ pipeFissGroup = pipeFissGroup,
+ edgesCircPipeGroup = edgesCircPipeGroup
+ )
+
+ return (meshPipe, meshPipeGroups, edgesCircPipeGroup)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from checkDecoupePartition import checkDecoupePartition
+
+ # -----------------------------------------------------------------------------
+ # --- peau et face de fissure
+ #
+ # --- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée
+ # il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
+ # liste de faces externes : facesDefaut
+ # liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
+
+def construitPartitionsPeauFissure(facesDefaut, fissPipe):
+ """
+ partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
+ Il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure.
+ @param facesDefaut liste de faces externes
+ @param fissPipe partition face de fissure etendue par pipe prolongé
+ @return partitionsPeauFissFond : liste de partitions face externe - fissure (None quand pas d'intersection)
+ """
+
+ logging.info('start')
+ partitionsPeauFissFond = []
+ ipart = 0
+ for filling in facesDefaut:
+ part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ isPart = checkDecoupePartition([fissPipe, filling], part)
+ if isPart: # on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte
+ otherFD = [fd for fd in facesDefaut if fd != filling]
+ if len(otherFD) > 0:
+ fissPipePart = geompy.MakePartition([fissPipe], otherFD, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ else:
+ fissPipePart = fissPipe
+ part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ partitionsPeauFissFond.append(part)
+ geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart )
+ else:
+ partitionsPeauFissFond.append(None)
+ ipart = ipart +1
+
+ return partitionsPeauFissFond
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from projettePointSurCourbe import projettePointSurCourbe
+
+def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
+ ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad):
+ """
+ création des points du maillage du pipe sur la face de peau
+ """
+ logging.info('start')
+
+ for i, edges in enumerate(listEdges):
+ idf = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
+ if idf >= 0:
+ gptdsk = []
+ if idf > 0: # idf vaut 0 ou 1
+ idf = -1 # si idf vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face)
+ centre = ptEdgeFond[idFillingFromBout[i]][idf]
+ name = "centre%d"%idf
+ geomPublish(initLog.debug, centre, name)
+ vertPipePeau = ptFisExtPi[idFillingFromBout[i]][idf]
+ geomPublishInFather(initLog.debug, centre, vertPipePeau, "vertPipePeau")
+ grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes
+ edgesCirc = []
+ for grpEdgesCirc in grpsEdgesCirc:
+ edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False)
+ for k, edge in enumerate(edges):
+ extrems = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True)
+ if geompy.MinDistance(centre, extrems[0]) < geompy.MinDistance(centre, extrems[1]):
+ bout = extrems[1]
+ else:
+ bout = extrems[0]
+ # ajustement du point extrémité (bout) sur l'edge circulaire en face de peau
+ logging.debug("edgesCirc: %s", edgesCirc)
+ distEdgeCirc = [(geompy.MinDistance(bout, edgeCirc), k2, edgeCirc) for k2, edgeCirc in enumerate(edgesCirc)]
+ distEdgeCirc.sort()
+ logging.debug("distEdgeCirc: %s", distEdgeCirc)
+ u = projettePointSurCourbe(bout, distEdgeCirc[0][2])
+ if (abs(u) < 0.02) or (abs(1-u) < 0.02): # les points très proches d'une extrémité doivent y être mis précisément.
+ extrCircs = geompy.ExtractShapes(distEdgeCirc[0][2], geompy.ShapeType["VERTEX"], True)
+ if geompy.MinDistance(bout, extrCircs[0]) < geompy.MinDistance(bout, extrCircs[1]):
+ bout = extrCircs[0]
+ else:
+ bout = extrCircs[1]
+ else:
+ bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u)
+ name ="bout%d"%k
+ geomPublishInFather(initLog.debug, centre, bout, name)
+ # enregistrement des points dans la structure
+ points = []
+ for j in range(nbsegRad +1):
+ u = j/float(nbsegRad)
+ points.append(geompy.MakeVertexOnCurve(edge, u))
+ if geompy.MinDistance(bout, points[0]) < geompy.MinDistance(centre, points[0]):
+ points.reverse()
+ points[0] = centre
+ points[-1] = bout
+ gptdsk.append(points)
+ if i == 0:
+ gptsdisks[idisklim[0] -1] = gptdsk
+ idisklim[0] = idisklim[0] -1
+ else:
+ gptsdisks[idisklim[1] +1] = gptdsk
+ idisklim[1] = idisklim[1] +1
+
+ return (gptsdisks, idisklim)
\ No newline at end of file
from creeZoneDefautMaillage import creeZoneDefautMaillage
from peauInterne import peauInterne
-from quadranglesToShape import quadranglesToShape
+from quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
from creeZoneDefautFilling import creeZoneDefautFilling
from creeZoneDefautGeom import creeZoneDefautGeom
from getCentreFondFiss import getCentreFondFiss
def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
shapeFissureParams, maillageFissureParams):
"""
- TODO: a compléter
+ #TODO: a compléter
"""
logging.info('start')
maillageSain.ExportMED( fichierMaillageSain, 0, SMESH.MED_V2_2, 1 )
logging.debug("fichier maillage sain %s", fichierMaillageSain)
[maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \
- peauInterne(fichierMaillageSain, nomZones)
+ peauInterne(fichierMaillageSain, shapeDefaut, nomZones)
facesDefaut = []
centresDefaut = []
isPlane = False
if isHexa and not isPlane:
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
- fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss)
+
+ fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
+
for filling in fillings:
[faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
else:
[facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion)
- bordsPartages =[]
+ bordsPartages = []
for face in facesDefaut:
bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
fillconts = facesDefaut
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- crée zone géométrique défaut a partir d'un filling
def creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion=50):
"""
Construction CAO de la zone à remailler, quand on utilise un filling,
- après appel creeZoneDefautMaillage et quadranglesToShape
+ après appel creeZoneDefautMaillage et quadranglesToShapeNoCorner
@param filling : la CAO de la peau du défaut reconstituée
@param shapeDefaut : objet géométrique représentant la fissure
(selon les cas, un point central, ou une shape plus complexe,
trace = True
facesDefaut = filling
centreSphere = geompy.MakeCDG(shapeDefaut)
- geompy.addToStudy(centreSphere, "cdg_defaut")
+ geomPublish(initLog.debug, centreSphere, "cdg_defaut")
centreDefaut = geompy.MakeProjection(centreSphere, filling)
if trace:
- geompy.addToStudy(centreDefaut, "centreDefaut")
+ geomPublish(initLog.debug, centreDefaut, "centreDefaut")
normalDefaut = geompy.GetNormal(filling, centreDefaut)
if trace:
- geompy.addToStudy(normalDefaut, "normalDefaut")
+ geomPublish(initLog.debug, normalDefaut, "normalDefaut")
extrusionDefaut = geompy.MakePrismVecH(filling, normalDefaut, -lgExtrusion)
if trace:
- geompy.addToStudy(extrusionDefaut, "extrusionDefaut")
+ geomPublish(initLog.debug, extrusionDefaut, "extrusionDefaut")
return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from prolongeVertices import prolongeVertices
# -----------------------------------------------------------------------------
curves.append(curve)
if trace:
name="poly_%d"%aShape
- geompy.addToStudy(curve, name)
+ geomPublish(initLog.debug, curve, name)
#
cdg = geompy.MakeCDG(curve)
cdgs.append(cdg)
if trace:
name="cdgpoly_%d"%aShape
- geompy.addToStudy(cdg, name)
+ geomPublish(initLog.debug, cdg, name)
#
projCdg = geompy.MakeProjection(cdg, face)
projs.append(projCdg)
if trace:
name="projCdg_%d"%aShape
- geompy.addToStudy(projCdg, name)
+ geomPublish(initLog.debug, projCdg, name)
#
normal = geompy.GetNormal(face, projCdg)
normals.append(normal)
if trace:
name="normal_%d"%aShape
- geompy.addToStudy(normal, name)
+ geomPublish(initLog.debug, normal, name)
#
extrusion = geompy.MakePrismVecH2Ways(curve, normal, 10)
extrusions.append(extrusion)
if trace:
name="extrusion_%d"%aShape
- geompy.addToStudy(extrusion, name)
+ geomPublish(initLog.debug, extrusion, name)
#
verticesProlongees = prolongeVertices(vertices)
#
curveprol = geompy.MakePolyline(verticesProlongees, False)
if trace:
name="polyProl_%d"%aShape
- geompy.addToStudy(curveprol, name)
+ geomPublish(initLog.debug, curveprol, name)
#
extruprol = geompy.MakePrismVecH2Ways(curveprol, normal, 10)
if trace:
name="extruProl_%d"%aShape
- geompy.addToStudy(extruprol, name)
+ geomPublish(initLog.debug, extruprol, name)
#
partition = geompy.MakePartition([face], [extruprol], [], [], geompy.ShapeType["FACE"], 0, [], 0)
partitions.append(partition)
if trace:
name="partition_%d"%aShape
- geompy.addToStudy(partition, name)
+ geomPublish(initLog.debug, partition, name)
pass
#
centreSphere = geompy.MakeCDG(shapeDefaut)
- geompy.addToStudy(centreSphere, "cdg_defaut")
+ geomPublish(initLog.debug, centreSphere, "cdg_defaut")
ccurves = geompy.MakeCompound(curves)
gravCenter = geompy.MakeCDG(ccurves)
- geompy.addToStudy(gravCenter, "cdg_curves")
+ geomPublish(initLog.debug, gravCenter, "cdg_curves")
for i in range(len(partitions)):
if trace:
logging.debug(" --- original shape %s", origShapes[i])
if d == minDist:
aFace = facesToSort[j]
name="decoupe_%d"%origShapes[i]
- geompy.addToStudy(aFace, name)
+ geomPublish(initLog.debug, aFace, name)
decoupes.append(aFace)
break
pass
facesDefaut = decoupes[0]
if len(decoupes) > 1:
facesDefaut = geompy.MakePartition(decoupes, [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- geompy.addToStudy(facesDefaut, "facesDefaut")
+ geomPublish(initLog.debug, facesDefaut, "facesDefaut")
shells=[]
if len(decoupes) > 1: # plusieurs faces de defaut
theFaces[k:k+1] = []
theShell = geompy.MakeShell(aShell)
name = "theShell%d"%len(shells)
- geompy.addToStudy(theShell,name)
+ geomPublish(initLog.debug, theShell,name)
shells.append(theShell)
#
distances = []
subFaces = [facesDefaut]
theShellDefaut = geompy.MakeShell(subFaces)
if trace:
- geompy.addToStudy(theShellDefaut,"theShellDefaut")
+ geomPublish(initLog.debug, theShellDefaut,"theShellDefaut")
theFaces = geompy.ExtractShapes(theShellDefaut, geompy.ShapeType["FACE"], True)
distances = []
centreDefaut = geompy.MakeProjection(centreSphere, theFaces[index])
if trace:
- geompy.addToStudy(centreDefaut, "centreDefaut")
+ geomPublish(initLog.debug, centreDefaut, "centreDefaut")
normalDefaut = geompy.GetNormal(subFaces[index], centreDefaut)
if trace:
- geompy.addToStudy(normalDefaut, "normalDefaut")
+ geomPublish(initLog.debug, normalDefaut, "normalDefaut")
extrusionDefaut = geompy.MakePrismVecH(theShellDefaut, normalDefaut, -lgExtrusion)
info = geompy.ShapeInfo(extrusionDefaut)
logging.debug("shape info %s", info)
solid0 = geompy.MakeFuse(solid0, solids[i])
extrusionDefaut = solid0
if trace:
- geompy.addToStudy(extrusionDefaut, "extrusionDefaut")
+ geomPublish(initLog.debug, extrusionDefaut, "extrusionDefaut")
return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut
nomZones, coordsNoeudsFissure):
"""
Identification de la zone à remailler, opérations sur le maillage
- de l'objet sain
+ de l'objet sain.
La zone à remailler est définie à partir d'un objet géométrique
ou à partir d'un jeu de points et d'une distance d'influence.
@param maillagesSains : (le maillage de l'objet initial, booleen isHexa)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from whichSideVertex import whichSideVertex
+
+def elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle):
+ """
+ recherche des points en trop (externes au volume à remailler)
+ - on associe chaque extrémité du pipe à une face filling
+ - on part des disques aux extrémités du pipe
+ - pour chaque disque, on prend les vertices de géométrie,
+ on marque leur position relative à la face.
+ - on s'arrete quand tous les noeuds sont dedans
+ """
+
+ logging.info('start')
+
+ pt0 = centres[0]
+ pt1 = centres[-1]
+ idFillingFromBout = [None, None] # contiendra l'index du filling pour les extrémités 0 et 1
+ nbFacesFilling = len(ptEdgeFond)
+ for ifil in range(nbFacesFilling):
+ for ipt, pt in enumerate(ptEdgeFond[ifil]): # il y a un ou deux points débouchant sur cette face
+ if geompy.MinDistance(pt,pt0) < geompy.MinDistance(pt,pt1): # TODO: trouver plus fiable pour les cas tordus...
+ idFillingFromBout[0] = ifil
+ else:
+ idFillingFromBout[1] = ifil
+ logging.debug("association bouts du pipe - faces de filling: %s", idFillingFromBout)
+
+ logging.debug("recherche des disques de noeuds complètement internes")
+ idisklim = [] # indices des premier et dernier disques internes
+ idiskout = [] # indices des premier et dernier disques externes
+ for bout in range(2):
+ if bout == 0:
+ idisk = -1
+ inc = 1
+ numout = -1
+ else:
+ idisk = len(gptsdisks)
+ inc = -1
+ numout = len(gptsdisks)
+ inside = False
+ outside = True
+ while not inside:
+ idisk = idisk + inc
+ logging.debug("examen disque %s", idisk)
+ gptdsk = gptsdisks[idisk]
+ inside = True
+ for k in range(nbsegCercle):
+ points = gptdsk[k]
+ for j, pt in enumerate(points):
+ side = whichSideVertex(facesDefaut[idFillingFromBout[bout]], pt)
+ if side < 0:
+ if outside: # premier point detecté dedans
+ outside = False
+ numout = idisk -inc # le disque précédent était dehors
+ else:
+ inside = False # ce point est dehors
+ if not inside and not outside:
+ break
+ idisklim.append(idisk) # premier et dernier disques internes
+ idiskout.append(numout) # premier et dernier disques externes
+
+ return (idFillingFromBout, idisklim, idiskout)
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from whichSide import whichSide
shapesInside.append(shape)
if trace:
name = prefix + "_Inside%d"%i
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
i+=1
elif side == -sideRef:
shapesOutside.append(shape)
if trace:
name = prefix + "_Outside%d"%j
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
j+=1
elif side == 0:
shapesOnside.append(shape)
if trace:
name = prefix + "_Onside%d"%k
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
k+=1
logging.debug("--- shape was %s", name)
return [shapesInside, shapesOutside, shapesOnside]
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from whichSideMulti import whichSideMulti
shapesInside.append(shape)
if trace:
name = prefix + "_Inside%d"%i
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
i+=1
elif side == -1:
shapesOutside.append(shape)
if trace:
name = prefix + "_Outside%d"%j
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
j+=1
elif side == 0:
shapesOnside.append(shape)
if trace:
name = prefix + "_Onside%d"%k
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
k+=1
logging.debug("--- shape was %s", name)
return [shapesInside, shapesOutside, shapesOnside]
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- TORE
faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
- geompy.addToStudyInFather( tore, faces[0], 'face0' )
- geompy.addToStudyInFather( tore, faces[1], 'face1' )
- geompy.addToStudyInFather( tore, faces[2], 'face2' )
- geompy.addToStudyInFather( tore, faces[3], 'face3' )
+ geomPublishInFather(initLog.debug, tore, faces[0], 'face0' )
+ geomPublishInFather(initLog.debug, tore, faces[1], 'face1' )
+ geomPublishInFather(initLog.debug, tore, faces[2], 'face2' )
+ geomPublishInFather(initLog.debug, tore, faces[3], 'face3' )
centres = [None, None, None, None]
[v1,centres[0],v3] = geompy.ExtractShapes(faces[0], geompy.ShapeType["VERTEX"], True)
[v1,centres[2],v3] = geompy.ExtractShapes(faces[2], geompy.ShapeType["VERTEX"], True)
[v1,centres[3],v3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["VERTEX"], True)
- geompy.addToStudyInFather( faces[0], centres[0], 'centre0' )
- geompy.addToStudyInFather( faces[1], centres[1], 'centre1' )
- geompy.addToStudyInFather( faces[2], centres[2], 'centre2' )
- geompy.addToStudyInFather( faces[3], centres[3], 'centre3' )
+ geomPublishInFather(initLog.debug, faces[0], centres[0], 'centre0' )
+ geomPublishInFather(initLog.debug, faces[1], centres[1], 'centre1' )
+ geomPublishInFather(initLog.debug, faces[2], centres[2], 'centre2' )
+ geomPublishInFather(initLog.debug, faces[3], centres[3], 'centre3' )
alledges = [None, None, None, None]
alledges[0] = geompy.ExtractShapes(faces[0], geompy.ShapeType["EDGE"], True)
dicoedge[edgid] = edgesface[j]
edges.append(edgesface[j])
named = 'edge_' + str(i) + '_' +str(j)
- geompy.addToStudyInFather( faces[i], edgesface[j], named)
+ geomPublishInFather(initLog.debug, faces[i], edgesface[j], named)
vertices = geompy.ExtractShapes(edgesface[j], geompy.ShapeType["VERTEX"], False)
#firstVertex = geompy.GetFirstVertex(edgesface[j])
if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i]):
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- faces fissure dans et hors tore, et edges face hors tore
facefissintore = f1
facefissoutore = f0
- geompy.addToStudyInFather(faceFissure, facefissintore,'facefissintore')
- geompy.addToStudyInFather(faceFissure, facefissoutore,'facefissoutore')
+ geomPublishInFather(initLog.debug, faceFissure, facefissintore,'facefissintore')
+ geomPublishInFather(initLog.debug, faceFissure, facefissoutore,'facefissoutore')
edgeint = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_IN)
edgeext = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_ON)
for i in range(len(edgeint)):
name = "edgeint_%d"%i
- geompy.addToStudyInFather(facefissoutore, edgeint[i],name)
+ geomPublishInFather(initLog.debug, facefissoutore, edgeint[i],name)
for i in range(len(edgeext)):
name = "edgeext_%d"%i
- geompy.addToStudyInFather(facefissoutore, edgeext[i],name)
+ geomPublishInFather(initLog.debug, facefissoutore, edgeext[i],name)
reverext = []
if len(edgeext) > 1:
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- identification des faces tore et fissure dans le solide hors tore du bloc partitionné
blocFaceTore1 = geompy.GetInPlaceByHistory(blocp, facetore1)
blocFaceTore2 = geompy.GetInPlaceByHistory(blocp, facetore2)
- geompy.addToStudyInFather(blocp, blocFaceFiss,'blocFaceFiss')
- geompy.addToStudyInFather(blocp, blocFaceTore1,'blocFaceTore1')
- geompy.addToStudyInFather(blocp, blocFaceTore2,'blocFaceTore2')
+ geomPublishInFather(initLog.debug, blocp, blocFaceFiss,'blocFaceFiss')
+ geomPublishInFather(initLog.debug, blocp, blocFaceTore1,'blocFaceTore1')
+ geomPublishInFather(initLog.debug, blocp, blocFaceTore2,'blocFaceTore2')
return blocFaceFiss, blocFaceTore1, blocFaceTore2
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from extractionOrientee import extractionOrientee
from getSubshapeIds import getSubshapeIds
#[facetore1,facetore2] = geompy.GetShapesOnShape(pipe0, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
- geompy.addToStudyInFather( tore, facetore1, 'facetore1' )
- geompy.addToStudyInFather( tore, facetore2, 'facetore2' )
+ geomPublishInFather(initLog.debug, tore, facetore1, 'facetore1' )
+ geomPublishInFather(initLog.debug, tore, facetore2, 'facetore2' )
[volumeTore1, volumeTore2] = geompy.ExtractShapes(tore, geompy.ShapeType["SOLID"], True)
- geompy.addToStudyInFather( tore, volumeTore1, 'volumeTore1' )
- geompy.addToStudyInFather( tore, volumeTore2, 'volumeTore2' )
+ geomPublishInFather(initLog.debug, tore, volumeTore1, 'volumeTore1' )
+ geomPublishInFather(initLog.debug, tore, volumeTore2, 'volumeTore2' )
return facetore1, facetore2, volumeTore1, volumeTore2
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- trouver les vertices extremites d'un wire
else:
idsubs[subid] = [sub]
name='vertex%d'%i
- geompy.addToStudyInFather(aWire, sub, name)
+ geomPublishInFather(initLog.debug, aWire, sub, name)
if getNormals:
idnorm[subid] = normals[i]
name='norm%d'%i
- geompy.addToStudyInFather(aWire, normals[i], name)
+ geomPublishInFather(initLog.debug, aWire, normals[i], name)
logging.debug("idsubs: %s", idsubs)
for k, v in idsubs.iteritems():
if len(v) == 1:
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- trouver les vertices intermediaires d'un wire
else:
idsubs[subid] = [sub]
name='vertex%d'%i
- geompy.addToStudyInFather(aWire, sub, name)
+ geomPublishInFather(initLog.debug, aWire, sub, name)
if getNormals:
idnorm[subid] = normals[i]
name='norm%d'%i
- geompy.addToStudyInFather(aWire, normals[i], name)
+ geomPublishInFather(initLog.debug, aWire, normals[i], name)
for k, v in idsubs.iteritems():
if len(v) > 1:
shortList.append(v[0])
# -*- coding: utf-8 -*-
from geomsmesh import geompy, smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import math
import GEOM
from triedreBase import triedreBase
from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from insereFissureGenerale import insereFissureGenerale
+from construitFissureGenerale import construitFissureGenerale
from sortEdges import sortEdges
O, OX, OY, OZ = triedreBase()
Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0)
tube_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2)
plan_y = geompy.MakePlaneLCS(None, 100000, 3)
- geompy.addToStudy( plan_y, "plan_y" )
- geompy.addToStudy( tube_1, "tube_1" )
- geompy.addToStudy( coude, "coude" )
- geompy.addToStudy( tube_2, "tube_2" )
+ geomPublish(initLog.debug, plan_y, "plan_y" )
+ geomPublish(initLog.debug, tube_1, "tube_1" )
+ geomPublish(initLog.debug, coude, "coude" )
+ geomPublish(initLog.debug, tube_2, "tube_2" )
P1 = O
- geompy.addToStudy( P1, "P1" )
+ geompy.addToStudy(P1, "P1" )
op2 = geompy.MakeVertex(0, 0, -l_tube_p1)
P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0)
P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2)
- geompy.addToStudy( P2, "P2" )
+ geompy.addToStudy(P2, "P2" )
# --- tube coude sain
geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
- geompy.addToStudy( geometrieSaine, self.nomCas )
+ geomPublish(initLog.debug, geometrieSaine, self.nomCas )
[P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True)
xmin = -de -r_cintr -l_tube_p2
grped = geompy.CutGroups(grpedy0, long_p1)
grped = geompy.CutGroups(grped, long_p2)
ep = geompy.CutGroups(grped, long_coude)
- geompy.addToStudyInFather( geometrieSaine, long_p1, 'long_p1' )
- geompy.addToStudyInFather( geometrieSaine, ep, 'ep' )
- geompy.addToStudyInFather( geometrieSaine, long_coude, 'long_coude' )
- geompy.addToStudyInFather( geometrieSaine, circ_g, 'circ_g' )
- geompy.addToStudyInFather( geometrieSaine, circ_d, 'circ_d' )
- geompy.addToStudyInFather( geometrieSaine, long_p2, 'long_p2' )
+ geomPublishInFather(initLog.debug, geometrieSaine, long_p1, 'long_p1' )
+ geomPublishInFather(initLog.debug, geometrieSaine, ep, 'ep' )
+ geomPublishInFather(initLog.debug, geometrieSaine, long_coude, 'long_coude' )
+ geomPublishInFather(initLog.debug, geometrieSaine, circ_g, 'circ_g' )
+ geomPublishInFather(initLog.debug, geometrieSaine, circ_d, 'circ_d' )
+ geomPublishInFather(initLog.debug, geometrieSaine, long_p2, 'long_p2' )
# --- face extremite tube (EXTUBE)
facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON)
EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(EXTUBE, facesIds)
- geompy.addToStudyInFather( geometrieSaine, EXTUBE, 'EXTUBE' )
+ geomPublishInFather(initLog.debug, geometrieSaine, EXTUBE, 'EXTUBE' )
# --- edge bord extremite tube (BORDTU)
edgesIds.append(edge)
BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionIDs(BORDTU, edgesIds)
- geompy.addToStudyInFather( geometrieSaine, BORDTU, 'BORDTU' )
+ geomPublishInFather(initLog.debug, geometrieSaine, BORDTU, 'BORDTU' )
# --- face origine tube (CLGV)
pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10)
vec2 = geompy.MakeVector(P2, pp2)
- #geompy.addToStudy(vec2, 'vec2')
+ #geomPublish(initLog.debug, vec2, 'vec2')
facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON)
CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(CLGV, facesIds)
- geompy.addToStudyInFather( geometrieSaine, CLGV, 'CLGV' )
+ geomPublishInFather(initLog.debug, geometrieSaine, CLGV, 'CLGV' )
# --- peau tube interieur (PEAUINT)
extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
interne = geompy.MakeFuse(extru1, revol1)
interne = geompy.MakeFuse(extru2, interne)
- geompy.addToStudy(interne, 'interne')
+ geomPublish(initLog.debug, interne, 'interne')
facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(PEAUINT, facesIds)
- geompy.addToStudyInFather( geometrieSaine, PEAUINT, 'PEAUINT' )
+ geomPublishInFather(initLog.debug, geometrieSaine, PEAUINT, 'PEAUINT' )
# --- peau tube exterieur (PEAUEXT)
extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
externe = geompy.MakeFuse(extru1, revol1)
externe = geompy.MakeFuse(extru2, externe)
- geompy.addToStudy(externe, 'externe')
+ geomPublish(initLog.debug, externe, 'externe')
facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON)
PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(PEAUEXT, facesIds)
- geompy.addToStudyInFather( geometrieSaine, PEAUEXT, 'PEAUEXT' )
+ geomPublishInFather(initLog.debug, geometrieSaine, PEAUEXT, 'PEAUEXT' )
# --- solide sain
volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"])
COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"])
geompy.UnionIDs(COUDE, volIds)
- geompy.addToStudyInFather( geometrieSaine, COUDE, 'COUDSAIN' )
+ geomPublishInFather(initLog.debug, geometrieSaine, COUDE, 'COUDSAIN' )
geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE]
azimut = -azimut # axe inverse / ASCOUF
axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
- geompy.addToStudy(axe,"axe")
+ geomPublish(initLog.debug, axe,"axe")
if not lgInfluence:
lgInfluence = profondeur
pi = geompy.MakeVertex(rayint, 0, 0)
pbl = geompy.MakeRotation(pb, OZ, angle)
pbr = geompy.MakeRotation(pb, OZ, -angle)
- geompy.addToStudy(pbl,"pbl")
- geompy.addToStudy(pbr,"pbr")
+ geomPublish(initLog.debug, pbl,"pbl")
+ geomPublish(initLog.debug, pbr,"pbr")
pal = geompy.MakeTranslationVector(pbl, OZ)
par = geompy.MakeTranslationVector(pbr, OZ)
axl = geompy.MakeVector(pbl,pal)
wire2 = geompy.MakeInterpol(points[2*nbp:3*nbp+1])
#wiretube = geompy.MakeInterpol(points)
wiretube=geompy.MakeWire([wire0,wire1,wire2])
- geompy.addToStudy(wiretube,"wiretube")
+ geomPublish(initLog.debug, wiretube,"wiretube")
pe = geompy.MakeVertex(rayext, 0, 0)
pe = geompy.MakeRotation(pe, OZ, azimut*math.pi/180.)
pe = geompy.MakeRotation(pe, axe, alpha*math.pi/180.)
arce = geompy.MakeArc(points[0], pe, points[-1])
- geompy.addToStudy(arce,"arce")
+ geomPublish(initLog.debug, arce,"arce")
facefiss = geompy.MakeFaceWires([arce, wiretube], 1)
- geompy.addToStudy( facefiss, 'facefissPlace' )
+ geomPublish(initLog.debug, facefiss, 'facefissPlace' )
pc = geompy.MakeVertex((raybor + rayint)/2.0, 0, 0)
centre = geompy.MakeRotation(pc, OZ, azimut*math.pi/180.)
centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1)
centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.)
- geompy.addToStudy( centre, 'centrefissPlace' )
+ geomPublish(initLog.debug, centre, 'centrefissPlace' )
wiretube = geompy.GetInPlace(facefiss, wiretube)
- geompy.addToStudy(wiretube, 'wiretubePlace' )
+ geomPublish(initLog.debug, wiretube, 'wiretubePlace' )
try:
edgetube = geompy.MakeEdgeWire(wiretube)
- geompy.addToStudy(edgetube,"edgetube")
+ geomPublish(initLog.debug, edgetube,"edgetube")
except:
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgetube = None
points.append(pt)
curves.append(geompy.MakeInterpol(points))
point0 = points[0]
- geompy.addToStudy(curves[-1],"curve0")
+ geomPublish(initLog.debug, curves[-1],"curve0")
# for i, pt in enumerate(points):
# name = "point%d"%i
-# geompy.addToStudyInFather(curves[-1], pt, name)
+# geomPublishInFather(initLog.debug,curves[-1], pt, name)
points = []
nbp = 3*nbp1
pt = geompy.MakeRotation(pi, axe, angi)
points.append(pt)
curves.append(geompy.MakeInterpol(points))
- geompy.addToStudy(curves[-1],"curve1")
+ geomPublish(initLog.debug, curves[-1],"curve1")
# for i, pt in enumerate(points):
# name = "point%d"%i
-# geompy.addToStudyInFather(curves[-1], pt, name)
+# geomPublishInFather(initLog.debug,curves[-1], pt, name)
points = []
nbp = 3*nbp1
points.append(pt)
curves.append(geompy.MakeInterpol(points))
point1 = points[-1]
- geompy.addToStudy(curves[-1],"curve2")
+ geomPublish(initLog.debug, curves[-1],"curve2")
# for i, pt in enumerate(points):
# name = "point%d"%i
-# geompy.addToStudyInFather(curves[-1], pt, name)
+# geomPublishInFather(initLog.debug,curves[-1], pt, name)
wiretube = geompy.MakeWire(curves)
- geompy.addToStudy(wiretube,"wiretube")
+ geomPublish(initLog.debug, wiretube,"wiretube")
try:
edgetube = geompy.MakeEdgeWire(wiretube)
- geompy.addToStudy(edgetube,"edgetube")
+ geomPublish(initLog.debug, edgetube,"edgetube")
except:
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgetube = None
pts.append(pt)
pts.append(point1)
arce = geompy.MakeInterpol(pts)
- geompy.addToStudy(arce,"arce")
+ geomPublish(initLog.debug, arce,"arce")
facefiss = geompy.MakeFaceWires([arce, wiretube], 0)
- geompy.addToStudy( facefiss, 'facefissPlace' )
+ geomPublish(initLog.debug, facefiss, 'facefissPlace' )
pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.)
centre = geompy.MakeRotation(pc, axe, alfrd)
- geompy.addToStudy( centre, 'centrefissPlace' )
+ geomPublish(initLog.debug, centre, 'centrefissPlace' )
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
edgesTriees, minl, maxl = sortEdges(edges)
edges = edgesTriees[:-1] # la plus grande correspond à arce, on l'elimine
wiretube = geompy.MakeWire(edges)
#wiretube = edgesTriees[-1]
- geompy.addToStudy(wiretube, 'wiretubePlace' )
+ geomPublish(initLog.debug, wiretube, 'wiretubePlace' )
# ---------------------------------------------------------
arci = geompy.MakePosition(arco, originLCS, localLCS, "arci")
arce = geompy.MakePosition(lino, originLCS, localLCS, "arce")
facefiss = geompy.MakeFaceWires([arce, arci], 0)
- geompy.addToStudy( facefiss, 'facefissPlace' )
+ geomPublish(initLog.debug, facefiss, 'facefissPlace' )
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
edgesTriees, minl, maxl = sortEdges(edges)
edgetube = edgesTriees[-1] # la plus grande correspond à arci
pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.)
centre = geompy.MakeRotation(pc, axe, alfrd)
- geompy.addToStudy( centre, 'centrefissPlace' )
+ geomPublish(initLog.debug, centre, 'centrefissPlace' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, profondeur/2. ,profondeur)
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
# -*- coding: utf-8 -*-
+import logging
+
from blocFissure import gmu
from blocFissure.gmu.initEtude import initEtude
from blocFissure.gmu.getStatsMaillageFissure import getStatsMaillageFissure
# ---------------------------------------------------------------------------
def executeProbleme(self, step=-1):
- print "executeProbleme", self.nomCas
+ logging.info(" --- executeProbleme %s", self.nomCas)
if step == 0:
return
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Jun 24 09:14:13 2014
+
+@author: I48174 (Olivier HOAREAU)
+"""
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+import SMESH
+
+from listOfExtraFunctions import createNewMeshesFromCorner
+from listOfExtraFunctions import createLinesFromMesh
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible, zoneDefaut_skin, shapeDefaut, listOfCorners):
+ """ """
+ # TODO: rédiger la docstring
+
+ logging.info("start")
+
+ facesNonCoupees = []
+ facesCoupees = []
+ maillagesNonCoupes = []
+ maillagesCoupes = []
+
+ # On crée une liste contenant le maillage de chaque face.
+ listOfNewMeshes = createNewMeshesFromCorner(maillageDefautCible, listOfCorners)
+
+ i = 0
+ while i < len(listOfNewMeshes):
+ lines = createLinesFromMesh(listOfNewMeshes[i])
+ setOfLines = []
+ for line in lines:
+ # On possède l'information 'ID' de chaque noeud composant chaque
+ # ligne de la face. A partir de l'ID, on crée un vertex. Un
+ # ensemble de vertices constitue une ligne. Un ensemble de lignes
+ # constitue la face.
+ tmpCoords = [maillageDefautCible.GetNodeXYZ(node) for node in line]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ setOfLines.append(line)
+
+ # A partir des lignes de la face,
+ # on recrée un objet GEOM temporaire par filling.
+ filling = geompy.MakeFilling(geompy.MakeCompound(setOfLines), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ #logging.debug("face de filling")
+ #geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
+
+ tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
+ tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
+ if len(tmpExplodeRef) == len(tmpExplodeNum):
+ logging.debug("face de filling non coupee")
+ geompy.addToStudy( filling, "faceNonCoupee_{0}".format(i + 1)) # doit etre publie pour critere OK plus bas
+ facesNonCoupees.append(filling)
+ maillagesNonCoupes.append(listOfNewMeshes[i])
+ else:
+ logging.debug("face de filling coupee")
+ geompy.addToStudy( filling, "faceCoupee_{0}".format(i + 1))
+ facesCoupees.append(filling)
+ maillagesCoupes.append(listOfNewMeshes[i])
+
+ i += 1
+
+ listOfInternMeshes = [maillageInterneCible] + [msh.GetMesh() for msh in maillagesNonCoupes]
+
+ newMaillageInterne = smesh.Concatenate(listOfInternMeshes, 1, 1, 1e-05, False)
+
+ facesEnTrop = []
+
+ criteres = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGenSurface, SMESH.FT_Undefined, face) for face in facesNonCoupees]
+ filtres = [smesh.GetFilterFromCriteria([critere]) for critere in criteres]
+ for i, filtre in enumerate(filtres):
+ filtre.SetMesh(maillageSain.GetMesh())
+ faceEnTrop = maillageSain.GroupOnFilter(SMESH.FACE, 'faceEnTrop_{0}'.format(i + 1), filtre)
+ facesEnTrop.append(faceEnTrop)
+
+ newZoneDefaut_skin = maillageSain.GetMesh().CutListOfGroups([zoneDefaut_skin], facesEnTrop, 'newZoneDefaut_skin')
+
+ smesh.SetName(newMaillageInterne, 'newInternalBoundary')
+
+ return newZoneDefaut_skin, newMaillageInterne
+
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from toreFissure import toreFissure
from ellipsoideDefaut import ellipsoideDefaut
plane1 = rotTrans(Plane_1, orientation, centreDefaut, vecteurDefaut)
ellipsoide1 = rotTrans(ellipsoide, orientation, centreDefaut, vecteurDefaut)
- geompy.addToStudy( pipe0, 'pipe0' )
- geompy.addToStudy( gener1, 'gener1' )
- geompy.addToStudy( pipe1, 'pipe1' )
- geompy.addToStudy( facefis1, 'facefis1' )
- geompy.addToStudy( plane1, 'plane1' )
- geompy.addToStudy( ellipsoide1, 'ellipsoide1' )
+ geomPublish(initLog.debug, pipe0, 'pipe0' )
+ geomPublish(initLog.debug, gener1, 'gener1' )
+ geomPublish(initLog.debug, pipe1, 'pipe1' )
+ geomPublish(initLog.debug, facefis1, 'facefis1' )
+ geomPublish(initLog.debug, plane1, 'plane1' )
+ geomPublish(initLog.debug, ellipsoide1, 'ellipsoide1' )
shapeDefaut = facefis1
xyz_defaut = geompy.PointCoordinates(centreDefaut)
def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize):
"""
- TODO: a completer
- """
+ -Permet de générer un maillage sur l'objet géométrique 'facefiss' via
+ l'algorithme NETGEN_1D2D :
+ -SetMaxSize = dimension max d'un élément (maxSize)
+ -SetSecondOrder = élément quadratique (Y=1, N=0)
+ -SetOptimize = élément régulier (Y=1, N=0)
+ -SetFineness = finesse du maillage
+ [very_coarse, coarse, moderate, fine, very_fine, custom]
+ [0, 1, 2, 3, 4, 5 ]
+ -SetMinSize = dimension min d'un élément (minSize)
+ -SetQuadAllowed = permission quadrangle dans maillage triangle
+ -On récupère les coordonnées de chaque noeud de la fissure qu'on stocke
+ dans une liste sous la forme : [X0, Y0, Z0, ..., Xn, Yn, Zn]"""
+
logging.info('start')
meshFissure = smesh.Mesh(facefiss)
import logging
logging.info('start')
+import initLog
import salome
salome.salome_init()
smesh = smeshBuilder.New(salome.myStudy)
logging.debug("initialisation de geompy et smesh OK")
+
+def geomPublish(level,aShape, aName):
+ if initLog.getLogLevel() <= level:
+ geompy.addToStudy(aShape, aName)
+
+def geomPublishInFather(level, aFather, aShape, aName):
+ if initLog.getLogLevel() <= level:
+ geompy.addToStudyInFather(aFather, aShape, aName)
+
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import bisect
publie = False
def getCentreFondFiss(shapesFissure):
"""
identification du centre de fond de fissure,
- transformation fond de fissure en edge unique (seulement pour la procédure insereFissureGenerale).
+ transformation fond de fissure en edge unique (seulement pour la procédure construitFissureGenerale).
On distingue le cas d'utilisation de la procédure insereFissureLongue par le nombre d'éléments de shapesFissure.
"""
global publie
logging.debug("start")
fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
- if len(shapesFissure) == 6: # procédure insereFissureGenerale, et edge fond de fissure fournie explicitement
+ if len(shapesFissure) == 6: # procédure construitFissureGenerale, et edge fond de fissure fournie explicitement
edgeFondExt = shapesFissure[5]
else:
edgeFondExt = None
if len(shapesFissure) > 6: # procédure insereFissureLongue (fissure plane, plusieurs edges sur le fond de fissure)
centreFondFiss = shapesFissure[1]
tgtCentre = None
- else: # procédure insereFissureGenerale, détermination edge unique et milieu de l'edge
+ else: # procédure construitFissureGenerale, détermination edge unique et milieu de l'edge
if geompy.NumberOfEdges(fondFiss) > 1:
if geompy.NbShapes(fondFiss, geompy.ShapeType["WIRE"]) > 0: # wire
aWire = fondFiss
edgeFondExt = fondFiss
aWire = geompy.MakeWire([fondFiss], 1e-07)
if not publie:
- geompy.addToStudy(aWire, "wireFondFissExt")
+ geomPublish(initLog.debug, aWire, "wireFondFissExt")
lgWire = geompy.BasicProperties(aWire)[0]
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], True)
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr])
else: # on ne sait pas comment est orientée l'edge unique, mais ça n'a pas d'importance
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
- geompy.addToStudyInFather(aWire, centreFondFiss, "centreFondFiss")
+ geomPublishInFather(initLog.debug,aWire, centreFondFiss, "centreFondFiss")
tgtCentre = geompy.MakeTangentOnCurve(edges[iedr], lgOnEdge/ lgEdges[iedr])
if edgeFondExt is None: # fond de fissure non fourni explicitement sous forme d'edge
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgeFondExt = None
if not publie and edgeFondExt is not None:
- geompy.addToStudy(edgeFondExt, "edgeFondExt")
+ geomPublish(initLog.debug, edgeFondExt, "edgeFondExt")
publie = True
return edgeFondExt, centreFondFiss, tgtCentre
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from substractSubShapes import substractSubShapes
+
+def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSorted,
+ edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees):
+ """
+ identification précise des edges et disques des faces de peau selon index extremité fissure
+ """
+ logging.info('start')
+
+ facesPipePeau = [None for i in range(len(edgesFissExtPipe))]
+ endsEdgeFond = [None for i in range(len(edgesFissExtPipe))]
+ edgeRadFacePipePeau = [None for i in range(len(edgesFissExtPipe))]
+
+ edgesListees = []
+ edgesCircPeau = []
+ verticesCircPeau = []
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+
+ for face in facesPeauSorted[:-1]: # la ou les faces débouchantes, pas la grande face de peau
+ logging.debug("examen face debouchante circulaire")
+ for i,efep in enumerate(edgesFissExtPipe):
+ dist = geompy.MinDistance(face, efep)
+ logging.debug(" distance face circulaire edge %s", dist)
+ if dist < 1e-3:
+ for ik, edpfi in enumerate(edgesPeauFondIn):
+ if geompy.MinDistance(face, edpfi) < 1e-3:
+ break
+ sharedVertices = geompy.GetSharedShapesMulti([face, edgesPeauFondIn[ik]], geompy.ShapeType["VERTEX"])
+ nameFace = "facePipePeau%d"%i
+ nameVert = "endEdgeFond%d"%i
+ nameEdge = "edgeRadFacePipePeau%d"%i
+ facesPipePeau[i] = face
+ endsEdgeFond[i] = sharedVertices[0]
+ geomPublish(initLog.debug, face, nameFace)
+ geomPublish(initLog.debug, sharedVertices[0], nameVert)
+ edgesFace = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
+ for edge in edgesFace:
+ if geompy.MinDistance(edge, sharedVertices[0]) < 1e-3:
+ edgeRadFacePipePeau[i] = edge
+ geomPublish(initLog.debug, edge, nameEdge)
+ break
+ pass
+ pass
+ pass
+ pass
+
+ # --- edges circulaires de la face de peau et points de jonction de la face externe de fissure
+ logging.debug("facesPipePeau: %s", facesPipePeau)
+ edgesCircPeau = [None for i in range(len(facesPipePeau))]
+ verticesCircPeau = [None for i in range(len(facesPipePeau))]
+ for i,fcirc in enumerate(facesPipePeau):
+ edges = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["EDGE"])
+ grpEdgesCirc = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
+ geompy.UnionList(grpEdgesCirc, edges)
+ edgesCircPeau[i] = grpEdgesCirc
+ name = "edgeCirc%d"%i
+ geomPublishInFather(initLog.debug, facePeau, grpEdgesCirc, name)
+ edgesListees = edgesListees + edges
+ vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"])
+ grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"])
+ geompy.UnionList(grpVertCircPeau, vertices)
+ verticesCircPeau[i] = grpVertCircPeau
+ name = "pointEdgeCirc%d"%i
+ geomPublishInFather(initLog.debug, facePeau, grpVertCircPeau, name)
+ pass
+ pass # --- au moins une extrémité du pipe sur cette face de peau
+
+ # --- edges de bord de la face de peau
+
+ edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
+ edgesBords = []
+ for i, edge in enumerate(edgesFilling):
+ edgepeau = geompy.GetInPlace(facePeau, edge)
+ name = "edgepeau%d"%i
+ geomPublishInFather(initLog.debug, facePeau,edgepeau, name)
+ logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau))
+ if geompy.ShapeInfo(edgepeau)['EDGE'] > 1:
+ logging.debug(" EDGES multiples")
+ edgs = geompy.ExtractShapes(edgepeau, geompy.ShapeType["EDGE"], False)
+ edgesBords += edgs
+ edgesListees += edgs
+ else:
+ logging.debug(" EDGE")
+ edgesBords.append(edgepeau)
+ edgesListees.append(edgepeau)
+ groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
+ geompy.UnionList(groupEdgesBordPeau, edgesBords)
+ bordsVifs = None
+ if aretesVivesC is not None:
+ logging.debug("identification des bords vifs par GetInPlace (old)")
+ bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC)
+ if bordsVifs is not None:
+ geomPublishInFather(initLog.debug, facePeau, bordsVifs, "bordsVifs")
+ groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs)
+ grptmp = None
+ if len(aretesVivesCoupees) > 0:
+ grpC = geompy.MakeCompound(aretesVivesCoupees)
+ grptmp = geompy.GetInPlace(facePeau, grpC)
+ if grptmp is not None:
+ grpnew = geompy.CutGroups(bordsVifs, grptmp) # ce qui est nouveau dans bordsVifs
+ else:
+ grpnew = bordsVifs
+ if grpnew is not None:
+ edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False)
+ aretesVivesCoupees += edv
+ logging.debug("aretesVivesCoupees %s",aretesVivesCoupees)
+ geomPublishInFather(initLog.debug, facePeau, groupEdgesBordPeau , "EdgesBords")
+
+ # --- edges de la face de peau partagées avec la face de fissure
+
+ edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
+ edges = substractSubShapes(facePeau, edgesPeau, edgesListees)
+ edgesFissurePeau = []
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ edgesFissurePeau = [None for i in range(len(verticesCircPeau))] # edges associés aux extrémités du pipe, en premier
+ for edge in edges:
+ for i, grpVert in enumerate(verticesCircPeau):
+ if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau):
+ edgesFissurePeau[i] = edge
+ name = "edgeFissurePeau%d"%i
+ geomPublishInFather(initLog.debug, facePeau, edge, name)
+ for edge in edges: # on ajoute après les edges manquantes
+ if edge not in edgesFissurePeau:
+ edgesFissurePeau.append(edge)
+ else:
+ for i, edge in enumerate(edges):
+ edgesFissurePeau.append(edge)
+ name = "edgeFissurePeau%d"%i
+ geomPublishInFather(initLog.debug, facePeau, edge, name)
+
+ return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
+ edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
+ bordsVifs, edgesFissurePeau, aretesVivesCoupees)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+import math
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from produitMixte import produitMixte
+from whichSide import whichSide
+
+def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
+ edgesFondIn, edgesFondFiss, wireFondFiss,
+ aretesVivesC, fillingFaceExterne,
+ edgesPipeIn, verticesPipePeau, rayonPipe,
+ facesInside, facesOnside):
+ """
+ elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
+ """
+
+ logging.info('start')
+
+ verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
+ pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice)
+ cercles = [] # les cercles de generation des pipes débouchant (même indice)
+ facesFissExt = [] # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice)
+ edgesFissExtPeau = [] # edges des faces de fissure externe sur la peau (même indice)
+ edgesFissExtPipe = [] # edges des faces de fissure externe sur le pipe (même indice)
+
+ #logging.debug("edgesFondIn %s", edgesFondIn)
+ for iedf, edge in enumerate(edgesFondIn):
+ name = "edgeFondIn%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
+ dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau]
+ ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge
+ [u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss)
+ logging.debug("u:%s, EdgeInWireIndex: %s, len(edgesFondFiss): %s", u, EdgeInWireIndex, len(edgesFondFiss))
+ localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex]
+ centre = PointOnEdge
+ centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre2, "centre2_%d"%iedf)
+ verticesEdgesFondIn.append(centre)
+ name = "verticeEdgesFondIn%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, name)
+ norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, "norm%d"%iedf)
+ cercle = geompy.MakeCircle(centre, norm, rayonPipe)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
+ [vertex] = geompy.ExtractShapes(cercle, geompy.ShapeType["VERTEX"], False)
+ vec1 = geompy.MakeVector(centre, vertex)
+ vec2 = geompy.MakeVector(centre, ptPeau)
+ angle = geompy.GetAngleRadians(vec1, vec2)
+ # cas général : on reconstitue une portion de pipe, avec l'arête de couture qui coincide
+ # avec la face de fissure, au niveau du débouché sur la face externe
+ # cas dégénéré : le pipe débouche perpendiculairement à une surface plane à l'origine.
+ # La partition filling / pipe reconstruit échoue.
+ # - Si on partitionne le filling avec un simple pipe obtenu par extrusion droite du cercle,
+ # cela donne un point en trop sur le cercle.
+ # - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
+ # les pipes reconstruits
+ logging.debug("angle=%s", angle)
+ #if abs(angle) > 1.e-7:
+ sommetAxe = geompy.MakeTranslationVector(centre, norm)
+ pm = produitMixte(centre, vertex, ptPeau, sommetAxe)
+ if pm > 0: # ajout de pi a (-)angle pour éviter des points confondus (partition échoue) dans les cas dégénérés
+ cercle = geompy.MakeRotation(cercle, norm, angle + math.pi)
+ else:
+ cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi)
+ name = "cercle%d"%iedf
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, name)
+ cercles.append(cercle)
+
+ # --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie
+ if aretesVivesC is None:
+ faceTestPeau = fillingFaceExterne
+ else:
+ faceTestPeau = facesDefaut[ifil]
+ sideCentre = whichSide(faceTestPeau, centre)
+ locPt0 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 0.0)
+ locPt1 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 1.0)
+ sidePt0 = whichSide(faceTestPeau, locPt0)
+ sidePt1 = whichSide(faceTestPeau, locPt1)
+ logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
+ normFace = geompy.GetNormal(faceTestPeau, ptPeau)
+ inclPipe = abs(geompy.GetAngleRadians(norm, normFace))
+ lgp = max(rayonPipe/2., abs(3*rayonPipe*math.tan(inclPipe)))
+ logging.debug("angle inclinaison Pipe en sortie: %s degres, lgp: %s", inclPipe*180/math.pi, lgp)
+
+ # --- position des points extremite du pipe sur l'edge debouchante
+ # il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante
+ locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False)
+ edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
+ edgesLocSorted.sort()
+ ofp = geompy.BasicProperties(edgesLocSorted[0][2])[0] # distance curviligne centre locPt0
+ logging.debug("distance curviligne centre extremite0: %s", ofp)
+ p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0)
+ p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0)
+ geomPublishInFather(initLog.debug, wireFondFiss, p1, "p1_%d"%iedf)
+ geomPublishInFather(initLog.debug, wireFondFiss, p2, "p2_%d"%iedf)
+
+ edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
+ for edp in edps:
+ if geompy.MinDistance(centre, edp) < 1.e-3:
+ pipext = geompy.MakePipe(cercle, edp)
+ name = "pipeExt%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, pipext, name)
+ pipexts.append(pipext)
+
+ for ifa, face in enumerate(facesInside):
+ logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)")
+ edgesPeauFis = []
+ edgesPipeFis = []
+ edgesPipeFnd = []
+ try:
+ edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
+ logging.debug(" faces onside %s",edgesPeauFis)
+ edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
+ logging.debug(" edgesPipeIn %s", edgesPipeFis)
+ edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"])
+ logging.debug(" edgesFondIn %s ", edgesPipeFnd)
+ except:
+ logging.debug(" pb edges communes %s %s %s",edgesPeauFis, edgesPipeFis, edgesPipeFnd)
+ pass
+ if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
+ dist = geompy.MinDistance(geompy.MakeCompound(edgesPeauFis), ptPeau)
+ logging.debug(" test distance extrémité reference %s", dist)
+ if dist < 1.e-3: # c'est la face de fissure externe associée
+ logging.debug(" face %s inside ajoutée", ifa)
+ facesFissExt.append(face)
+ name="faceFissExt%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, face, name)
+ dist = 1.
+ for ipe, edpe in enumerate(edgesPeauFis):
+ for ipi, edpi in enumerate(edgesPipeFis):
+ dist = geompy.MinDistance(edpe, edpi)
+ if dist < 1.e-3:
+ edgesFissExtPeau.append(edpe)
+ name="edgesFissExtPeau%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edpe, name)
+ edgesFissExtPipe.append(edpi)
+ name="edgesFissExtPipe%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edpi, name)
+ break
+ if dist < 1.e-3:
+ break
+
+ return (verticesEdgesFondIn, pipexts, cercles, facesFissExt, edgesFissExtPeau, edgesFissExtPipe)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from extractionOrientee import extractionOrientee
+from extractionOrienteeMulti import extractionOrienteeMulti
+
+def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
+ edgesPipeFiss, edgesFondFiss, aretesVivesC,
+ fillingFaceExterne, centreFondFiss):
+ """
+ # -----------------------------------------------------------------------
+ # --- identification edges fond de fissure, edges pipe sur la face de fissure,
+ # edges prolongées
+ # edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
+ """
+
+ logging.info('start')
+
+ edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss))
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
+ edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesFondC, "edgesFondFiss")
+
+ if aretesVivesC is None:
+ [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
+ [facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
+ else:
+ [edgesInside, edgesOutside, edgesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
+ [facesInside, facesOutside, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
+
+ edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
+ verticesPipePeau = []
+
+ for i, edge in enumerate(edgesPipeIn):
+ try:
+ vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"])
+ verticesPipePeau.append(vertices[0])
+ name = "edgePipeIn%d"%i
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
+ name = "verticePipePeau%d"%i
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, vertices[0], name)
+ logging.debug("edgePipeIn%s coupe les faces OnSide", i)
+ except:
+ logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i)
+
+ edgesFondIn =[]
+ if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
+ #tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
+ #edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+ tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
+ edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+
+ return (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from identifieElementsFissure import identifieElementsFissure
+from identifieElementsDebouchants import identifieElementsDebouchants
+from trouveEdgesFissPeau import trouveEdgesFissPeau
+from identifieFacesPeau import identifieFacesPeau
+from identifieEdgesPeau import identifieEdgesPeau
+
+def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
+ edgesFondFiss, wireFondFiss, aretesVivesC,
+ facesDefaut, centreFondFiss, rayonPipe,
+ aretesVivesCoupees):
+ """
+ """
+ logging.info('start')
+ fillingFaceExterne = facesDefaut[ifil]
+
+ logging.debug("traitement partitionPeauFissFond %s", ifil)
+
+ # --- identification edges fond de fissure, edges pipe sur la face de fissure, edges prolongées
+ # edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
+
+ (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside) = identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
+ edgesPipeFiss, edgesFondFiss, aretesVivesC,
+ fillingFaceExterne, centreFondFiss)
+
+ # --- elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
+
+ (verticesEdgesFondIn, pipexts, cercles,
+ facesFissExt, edgesFissExtPeau, edgesFissExtPipe) = identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
+ edgesFondIn, edgesFondFiss, wireFondFiss,
+ aretesVivesC, fillingFaceExterne,
+ edgesPipeIn, verticesPipePeau, rayonPipe,
+ facesInside, facesOnside)
+
+ # --- pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau
+
+ if len(verticesPipePeau) == 0: # aucune extrémité du pipe sur cette face de peau
+ edgesFissExtPeau = trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau)
+
+ # --- inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
+
+ (facePeau, facesPeauSorted, edgesPeauFondIn) = identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
+ verticesEdgesFondIn, pipexts, cercles,
+ fillingFaceExterne, centreFondFiss)
+
+ # --- identification précise des edges et disques des faces de peau selon index extremité fissure
+
+ (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
+ edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
+ bordsVifs, edgesFissurePeau, aretesVivesCoupees) = identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSorted,
+ edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees)
+
+ dataPPFF = dict(endsEdgeFond = endsEdgeFond, # pour chaque face [points edge fond de fissure aux débouchés du pipe]
+ facesPipePeau = facesPipePeau, # pour chaque face [faces du pipe débouchantes]
+ edgeRadFacePipePeau = edgeRadFacePipePeau, # pour chaque face [edge radiale des faces du pipe débouchantes ]
+ facesFissExt = facesFissExt, # pour chaque face [faces de fissure externes au pipe]
+ edgesFissExtPeau = edgesFissExtPeau, # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
+ edgesFissExtPipe = edgesFissExtPipe, # pour chaque face [edge commun au pipe des faces de fissure externes]
+ facePeau = facePeau, # pour chaque face : la face de peau finale a mailler (percee des faces débouchantes)
+ edgesCircPeau = edgesCircPeau, # pour chaque face de peau : [groupe subshapes edges circulaires aux débouchés du pipe]
+ verticesCircPeau = verticesCircPeau, # pour chaque face de peau : [groupe subshapes points sur edges circulaires aux débouchés du pipe]
+ groupEdgesBordPeau = groupEdgesBordPeau, # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ bordsVifs = bordsVifs, # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
+ edgesFissurePeau = edgesFissurePeau, # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ verticesPipePeau = verticesPipePeau # pour chaque face de peau : [point commun edFissPeau edCircPeau]
+ )
+
+ return dataPPFF, aretesVivesCoupees
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss):
+ """
+ identification des faces et edges de fissure externe pour maillage
+ """
+ logging.info('start')
+
+ facesFissExt = []
+ edgesFissExtPeau = []
+ edgesFissExtPipe = []
+ for ifil in range(len(fsFissuExt)): # TODO: éliminer les doublons (comparer tous les vertices triés, avec mesure de distance ?)
+ facesFissExt += fsFissuExt[ifil]
+ edgesFissExtPeau += edFisExtPe[ifil]
+ edgesFissExtPipe += edFisExtPi[ifil]
+ logging.debug("---------------------------- identification faces de fissure externes au pipe :%s ", len(facesFissExt))
+ # regroupement des faces de fissure externes au pipe.
+
+ if len(facesFissExt) > 1:
+ faceFissureExterne = geompy.MakePartition(facesFissExt, [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
+ # edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
+ # il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
+ (isDone, closedFreeBoundaries, openFreeBoundaries) = geompy.GetFreeBoundary(faceFissureExterne)
+ edgesBordFFE = []
+ for bound in closedFreeBoundaries:
+ edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
+ edgesBordFFEid = [ (ed,geompy.GetSubShapeID(faceFissureExterne, ed)) for ed in edgesBordFFE]
+ logging.debug("edgesBordFFEid %s", edgesBordFFEid)
+ edgesPPE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
+ edgesPPEid = [ geompy.GetSubShapeID(faceFissureExterne, ed) for ed in edgesPPE]
+ logging.debug("edgesPPEid %s", edgesPPEid)
+ edgesPFE = [ edid[0] for edid in edgesBordFFEid if edid[1] not in edgesPPEid] # on garde toutes les edges de bord non en contact avec le pipe
+ logging.debug("edgesPFE %s", edgesPFE)
+ edgesPeauFissureExterneC = geompy.MakeCompound(edgesPFE)
+ else:
+ faceFissureExterne = facesFissExt[0]
+ edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau)
+ edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe)
+ wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False))
+ geomPublish(initLog.debug, faceFissureExterne, "faceFissureExterne")
+ geomPublishInFather(initLog.debug, faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne")
+ geomPublishInFather(initLog.debug, faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne")
+
+ return (faceFissureExterne, edgesPipeFissureExterneC, wirePipeFissureExterne, edgesPeauFissureExterneC)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from sortFaces import sortFaces
+from extractionOrientee import extractionOrientee
+
+def identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
+ verticesEdgesFondIn, pipexts, cercles,
+ fillingFaceExterne, centreFondFiss):
+ """
+ inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
+ La partition avec le pipe peut créer un vertex (et un edge) de trop sur le cercle projeté,
+ quand le cercle est très proche de la face.
+ dans ce cas, la projection du cercle sur la face suivie d'une partition permet
+ d'éviter le point en trop
+ """
+ logging.info('start')
+
+ facesAndFond = facesOnside
+ facesAndFond.append(wireFondFiss)
+ try:
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, pipexts, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ except:
+ logging.debug("probleme partition face pipe, contournement avec MakeSection")
+ sections = []
+ for pipext in pipexts:
+ sections.append(geompy.MakeSection(facesOnside[0], pipext))
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, sections, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+
+ # contrôle edge en trop sur edges circulaires
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ edgeEnTrop = []
+ outilPart = pipexts
+ facesPeau = geompy.ExtractShapes(partitionPeauByPipe, geompy.ShapeType["FACE"], False)
+ facesPeauSorted, minsur, maxsurf = sortFaces(facesPeau)
+ for i, face in enumerate(facesPeauSorted[:-1]): # on ne teste que la ou les petites faces "circulaires"
+ nbv = geompy.NumberOfEdges(face)
+ logging.debug("nombre d'edges sur face circulaire: %s", nbv)
+ if nbv > 3:
+ edgeEnTrop.append(True) # TODO : distinguer les cas avec deux faces circulaires dont l'une est correcte
+ else:
+ edgeEnTrop.append(False)
+ refaire = sum(edgeEnTrop)
+ if refaire > 0:
+ dc = [(geompy.MinDistance(verticesEdgesFondIn[0], fac), i) for i, fac in enumerate(facesPeauSorted[:-1])]
+ dc.sort()
+ logging.debug("dc sorted: %s", dc)
+ i0 = dc[0][1] # indice de facesPeauSorted qui correspond à verticesEdgesFondIn[0], donc 0 pour cercles
+ direct = (i0 == 0)
+ for i, bad in enumerate(edgeEnTrop):
+ if direct:
+ j = i
+ else:
+ j = 1-i
+ if bad:
+ outilPart[j] = geompy.MakeProjection(cercles[j],facesOnside[0])
+ pass
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, outilPart, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ pass
+
+ name="partitionPeauByPipe%d"%ifil
+ geomPublish(initLog.debug, partitionPeauByPipe, name)
+ [edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
+ [facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3)
+
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFondOn)
+ facePeau = facesPeauSorted[-1] # la plus grande face
+ else:
+ facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ facesPeauSorted = [facePeau]
+ name="facePeau%d"%ifil
+ geomPublish(initLog.debug, facePeau, name)
+
+ return (facePeau, facesPeauSorted, edgesPeauFondIn)
\ No newline at end of file
import logging
+debug = 10
+info = 20
+warning = 30
+error = 40
+critical = 50
+
+loglevel = warning
+
def setDebug():
+ global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.DEBUG)
- logging.info('start Debug')
+ loglevel = debug
+ logging.info('start Debug %s', loglevel)
def setVerbose():
+ global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.INFO)
- logging.info('start Verbose')
+ loglevel = info
+ logging.info('start Verbose %s', loglevel)
def setRelease():
+ global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.WARNING)
- logging.warning('start Release')
+ loglevel = warning
+ logging.warning('start Release %s', loglevel)
def setUnitTests():
+ global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.CRITICAL)
- logging.critical('start UnitTests')
+ loglevel = critical
+ logging.critical('start UnitTests %s', loglevel)
+
+def setPerfTests():
+ global loglevel
+ logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.CRITICAL)
+ loglevel = critical
+ logging.info('start PerfTests %s', loglevel)
+
+def getLogLevel():
+ return loglevel
#logging.basicConfig(filename='myapp.log',
# format='%(asctime)s %(message)s',
import logging
import salome
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from geomsmesh import smesh
import SMESH
import math
#plane1 = self.rotTrans(Plane_1, orientation, centreDefaut, normalDefaut)
#ellipsoide1 = self.rotTrans(ellipsoide, orientation, centreDefaut, normalDefaut)
- #geompy.addToStudy( pipe0, 'pipe0' )
- #geompy.addToStudy( gener1, 'gener1' )
- #geompy.addToStudy( pipe1, 'pipe1' )
- #geompy.addToStudy( facefis1, 'facefis1' )
- #geompy.addToStudy( plane1, 'plane1' )
- #geompy.addToStudy( ellipsoide1, 'ellipsoide1' )
+ #geomPublish(initLog.debug, pipe0, 'pipe0' )
+ #geomPublish(initLog.debug, gener1, 'gener1' )
+ #geomPublish(initLog.debug, pipe1, 'pipe1' )
+ #geomPublish(initLog.debug, facefis1, 'facefis1' )
+ #geomPublish(initLog.debug, plane1, 'plane1' )
+ #geomPublish(initLog.debug, ellipsoide1, 'ellipsoide1' )
# --- partition du bloc défaut par génératrice, tore et plan fissure
if step == 7:
import logging
import salome
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import GEOM
from geomsmesh import smesh
from salome.smesh import smeshBuilder
#fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
- facesDefaut = elementsDefaut[0] # fillings des faces en peau
+ # fillings des faces en peau
+ facesDefaut = elementsDefaut[0]
#centresDefaut = elementsDefaut[1]
#normalsDefaut = elementsDefaut[2]
#extrusionsDefaut = elementsDefaut[3]
dmoyen = elementsDefaut[4]
- bordsPartages = elementsDefaut[5]
+ bordsPartages = elementsDefaut[5]
fillconts = elementsDefaut[6]
idFilToCont = elementsDefaut[7]
maillageSain = elementsDefaut[8]
# partition face fissure étendue par fillings, on garde la plus grande face
partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0)
- geompy.addToStudy(partShapeDefaut, 'partShapeDefaut')
+ geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut')
facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False)
if isPointInterne:
distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)]
else:
facesPartShapeDefautSorted, minSurf, maxSurf = sortFaces(facesPartShapeDefaut) # la face de fissure dans le volume doit être la plus grande
logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf)
- facesPortFissure = facesPartShapeDefautSorted[-1]
+ facesPortFissure = facesPartShapeDefautSorted[-1] #= global
- geompy.addToStudy(facesPortFissure, "facesPortFissure")
+ geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
O, OX, OY, OZ = triedreBase()
if geompy.NumberOfFaces(shapeDefaut) == 1:
plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000)
- shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss)
- geompy.addToStudy(shapeDefaut, 'shapeDefaut_coupe')
- geompy.addToStudyInFather(shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
+ shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0) #= local
+ #fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
+ geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe')
+ #geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
extrem, norms = findWireEndVertices(fondFiss, True)
logging.debug("extrem: %s, norm: %s",extrem, norms)
cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe)
cercle = geompy.MakeRotation(cercle, norms[0], math.pi/3.0 ) # éviter d'avoir l'arête de couture du pipe presque confondue avec la face fissure
- geompy.addToStudy(cercle, 'cercle')
+ geomPublish(initLog.debug, cercle, 'cercle')
fondFissProlonge = prolongeWire(fondFiss, extrem, norms, 2*rayonPipe)
pipeFiss = geompy.MakePipe(cercle, fondFissProlonge)
- geompy.addToStudy(pipeFiss, 'pipeFiss')
+ geomPublish(initLog.debug, pipeFiss, 'pipeFiss')
partFissPipe = geompy.MakePartition([shapeDefaut, pipeFiss], [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
- geompy.addToStudy(partFissPipe, 'partFissPipe')
- fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut)
- geompy.addToStudy(fissPipe, 'fissPipe')
- partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss)
- geompy.addToStudy(partPipe, 'partPipe')
+ geomPublish(initLog.debug, partFissPipe, 'partFissPipe')
+ fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut) #= global
+ geomPublish(initLog.debug, fissPipe, 'fissPipe')
+ partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss) #= local
+ geomPublish(initLog.debug, partPipe, 'partPipe')
- edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"])
+ edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"]) #= global
for i, edge in enumerate(edgesPipeFiss):
name = "edgePipe%d"%i
- geompy.addToStudyInFather(fissPipe, edge, name)
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
try:
- wirePipeFiss = geompy.MakeWire(edgesPipeFiss)
+ wirePipeFiss = geompy.MakeWire(edgesPipeFiss) #= global
except:
wirePipeFiss = geompy.MakeCompound(edgesPipeFiss)
logging.debug("wirePipeFiss construit sous forme de compound")
- geompy.addToStudy(wirePipeFiss, "wirePipeFiss")
+ geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss")
wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss)
edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"])
for i, edge in enumerate(edgesFondFiss):
name = "edgeFondFiss%d"%i
- geompy.addToStudyInFather(fissPipe, edge, name)
- wireFondFiss = geompy.MakeWire(edgesFondFiss)
- geompy.addToStudy(wireFondFiss,"wireFondFiss")
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ wireFondFiss = geompy.MakeWire(edgesFondFiss) #= global
+ geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
# -----------------------------------------------------------------------------
# --- peau et face de fissure
# il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
# liste de faces externes : facesDefaut
# liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
-
- partitionsPeauFissFond = []
+
+ partitionsPeauFissFond = [] #= global
ipart = 0
for filling in facesDefaut:
part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
fissPipePart = fissPipe
part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
partitionsPeauFissFond.append(part)
- geompy.addToStudy( part, 'partitionPeauFissFond%d'%ipart )
+ geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart )
else:
partitionsPeauFissFond.append(None)
ipart = ipart +1
+
+
+ # --- arêtes vives détectées (dans quadranglesToShapeNoCorner
+ # et quadranglesToShapeWithCorner)
- # --- arêtes vives détectées (dans quadranglesToShape)
-
aretesVives = []
- aretesVivesCoupees = []
+ aretesVivesCoupees = [] #= global
ia = 0
for a in bordsPartages:
- if a[0] is not None:
- aretesVives.append(a[0])
- name = "areteVive%d"%ia
- geompy.addToStudy(a[0], name)
- ia += 1
- aretesVivesC = None
+ if not isinstance(a, list):
+ aretesVives.append(a)
+ name = "areteVive%d"%ia
+ geomPublish(initLog.debug, a, name)
+ ia += 1
+ else:
+ if a[0] is not None:
+ aretesVives.append(a[0])
+ name = "areteVive%d"%ia
+ geomPublish(initLog.debug, a[0], name)
+ ia += 1
+
+ aretesVivesC = None #= global
if len(aretesVives) > 0:
aretesVivesC =geompy.MakeCompound(aretesVives)
ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
- fillingFaceExterne = facesDefaut[ifil]
- fillingSansDecoupe = fillconts[idFilToCont[ifil]]
if partitionPeauFissFond is not None:
+ fillingFaceExterne = facesDefaut[ifil]
+ #fillingSansDecoupe = fillconts[idFilToCont[ifil]]
logging.debug("traitement partitionPeauFissFond %s", ifil)
# -----------------------------------------------------------------------
# --- identification edges fond de fissure, edges pipe sur la face de fissure,
# edges prolongées
- edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss))
- geompy.addToStudyInFather(partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
- edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
- geompy.addToStudyInFather(partitionPeauFissFond, edgesFondC, "edgesFondFiss")
+ edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss)) #= local
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
+ edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss)) #= local
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesFondC, "edgesFondFiss")
- if aretesVivesC is None:
+ if aretesVivesC is None: #= global facesInside facesOnside
[edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
else:
[edgesInside, edgesOutside, edgesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[facesInside, facesOutside, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
- edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
- verticesPipePeau = []
+ edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"]) #= global
+ verticesPipePeau = [] #= global
for i, edge in enumerate(edgesPipeIn):
try:
vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"])
verticesPipePeau.append(vertices[0])
name = "edgePipeIn%d"%i
- geompy.addToStudyInFather(partitionPeauFissFond, edge, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edge, name)
name = "verticePipePeau%d"%i
- geompy.addToStudyInFather(partitionPeauFissFond, vertices[0], name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, vertices[0], name)
logging.debug("edgePipeIn%s coupe les faces OnSide", i)
except:
logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i)
- edgesFondOut = []
- edgesFondIn =[]
+ #edgesFondOut = [] #= inutile
+ edgesFondIn =[] #= global
if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
- tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
- edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+ #tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
+ #edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+
verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice)
cercles = [] # les cercles de generation des pipes débouchant (même indice)
edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss)
for i,edge in enumerate(edgesFondFiss):
- geompy.addToStudyInFather(wireFondFiss, edge, "edgeFondFiss%d"%i)
+ geomPublishInFather(initLog.debug,wireFondFiss, edge, "edgeFondFiss%d"%i)
for iedf, edge in enumerate(edgesFondIn):
name = "edgeFondIn%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edge, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edge, name)
dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau]
ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge
[u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss)
localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex]
centre = PointOnEdge
centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u)
- geompy.addToStudyInFather(partitionPeauFissFond, centre2, "centre2_%d"%iedf)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, centre2, "centre2_%d"%iedf)
verticesEdgesFondIn.append(centre)
name = "verticeEdgesFondIn%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, centre, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, name)
norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u)
- geompy.addToStudyInFather(partitionPeauFissFond, centre, "norm%d"%iedf)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, "norm%d"%iedf)
cercle = geompy.MakeCircle(centre, norm, rayonPipe)
- geompy.addToStudyInFather(partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
[vertex] = geompy.ExtractShapes(cercle, geompy.ShapeType["VERTEX"], False)
vec1 = geompy.MakeVector(centre, vertex)
vec2 = geompy.MakeVector(centre, ptPeau)
else:
cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi)
name = "cercle%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, cercle, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, name)
cercles.append(cercle)
# --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie
logging.debug("distance curviligne centre extremite0: %s", ofp)
p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0)
p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0)
- geompy.addToStudyInFather(wireFondFiss, p1, "p1_%d"%iedf)
- geompy.addToStudyInFather(wireFondFiss, p2, "p2_%d"%iedf)
+ geomPublishInFather(initLog.debug,wireFondFiss, p1, "p1_%d"%iedf)
+ geomPublishInFather(initLog.debug,wireFondFiss, p2, "p2_%d"%iedf)
edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
if geompy.MinDistance(centre, edp) < 1.e-3:
pipext = geompy.MakePipe(cercle, edp)
name = "pipeExt%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, pipext, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, pipext, name)
pipexts.append(pipext)
for face in facesInside:
logging.debug(" face %s inside ajoutée", i)
facesFissExt.append(face)
name="faceFissExt%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, face, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, face, name)
dist = 1.
for ipe, edpe in enumerate(edgesPeauFis):
for ipi, edpi in enumerate(edgesPipeFis):
if dist < 1.e-3:
edgesFissExtPeau.append(edpe)
name="edgesFissExtPeau%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edpe, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edpe, name)
edgesFissExtPipe.append(edpi)
name="edgesFissExtPipe%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edpi, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edpi, name)
break
if dist < 1.e-3:
break
if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
edgesFissExtPeau.append(edgesPeauFis[0])
name="edgesFissExtPeau%d"%j
- geompy.addToStudyInFather(partitionPeauFissFond, edgesPeauFis[0], name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name)
j += 1
# -----------------------------------------------------------------------
pass
name="partitionPeauByPipe%d"%ifil
- geompy.addToStudy(partitionPeauByPipe, name)
+ geomPublish(initLog.debug, partitionPeauByPipe, name)
[edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
[facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3)
else:
facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
name="facePeau%d"%ifil
- geompy.addToStudy(facePeau, name)
+ geomPublish(initLog.debug, facePeau, name)
facesPipePeau = [None for i in range(len(edgesFissExtPipe))]
endsEdgeFond = [None for i in range(len(edgesFissExtPipe))]
nameEdge = "edgeRadFacePipePeau%d"%i
facesPipePeau[i] = face
endsEdgeFond[i] = sharedVertices[0]
- geompy.addToStudy(face, nameFace)
- geompy.addToStudy(sharedVertices[0], nameVert)
+ geomPublish(initLog.debug, face, nameFace)
+ geomPublish(initLog.debug, sharedVertices[0], nameVert)
edgesFace = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
for edge in edgesFace:
if geompy.MinDistance(edge, sharedVertices[0]) < 1e-3:
edgeRadFacePipePeau[i] = edge
- geompy.addToStudy(edge, nameEdge)
+ geomPublish(initLog.debug, edge, nameEdge)
break
pass
pass
geompy.UnionList(grpEdgesCirc, edges)
edgesCircPeau[i] = grpEdgesCirc
name = "edgeCirc%d"%i
- geompy.addToStudyInFather(facePeau, grpEdgesCirc, name)
+ geomPublishInFather(initLog.debug,facePeau, grpEdgesCirc, name)
edgesListees = edgesListees + edges
vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"])
grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"])
geompy.UnionList(grpVertCircPeau, vertices)
verticesCircPeau[i] = grpVertCircPeau
name = "pointEdgeCirc%d"%i
- geompy.addToStudyInFather(facePeau, grpVertCircPeau, name)
+ geomPublishInFather(initLog.debug,facePeau, grpVertCircPeau, name)
pass
pass # --- au moins une extrémité du pipe sur cette face de peau
for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
name = "edgepeau%d"%i
- geompy.addToStudyInFather(facePeau,edgepeau, name)
+ geomPublishInFather(initLog.debug,facePeau,edgepeau, name)
logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau))
if geompy.ShapeInfo(edgepeau)['EDGE'] > 1:
logging.debug(" EDGES multiples")
if aretesVivesC is not None:
bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC)
if bordsVifs is not None:
- geompy.addToStudyInFather(facePeau, bordsVifs, "bordsVifs")
+ geomPublishInFather(initLog.debug,facePeau, bordsVifs, "bordsVifs")
groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs)
grptmp = None
if len(aretesVivesCoupees) > 0:
edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False)
aretesVivesCoupees += edv
logging.debug("aretesVivesCoupees %s",aretesVivesCoupees)
- geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords")
+ geomPublishInFather(initLog.debug,facePeau, groupEdgesBordPeau , "EdgesBords")
# --- edges de la face de peau partagées avec la face de fissure
if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau):
edgesFissurePeau[i] = edge
name = "edgeFissurePeau%d"%i
- geompy.addToStudyInFather(facePeau, edge, name)
+ geomPublishInFather(initLog.debug,facePeau, edge, name)
for edge in edges: # on ajoute après les edges manquantes
if edge not in edgesFissurePeau:
edgesFissurePeau.append(edge)
for i, edge in enumerate(edges):
edgesFissurePeau.append(edge)
name = "edgeFissurePeau%d"%i
- geompy.addToStudyInFather(facePeau, edge, name)
+ geomPublishInFather(initLog.debug,facePeau, edge, name)
ptEdgeFond[ifil] = endsEdgeFond # pour chaque face [points edge fond de fissure aux débouchés du pipe]
for i, avc in enumerate(aretesVivesCoupees):
name = "areteViveCoupee%d"%i
- geompy.addToStudy(avc, name)
+ geomPublish(initLog.debug, avc, name)
# --- identification des faces et edges de fissure externe pour maillage
edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau)
edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe)
wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False))
- geompy.addToStudy(faceFissureExterne, "faceFissureExterne")
- geompy.addToStudyInFather(faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne")
- geompy.addToStudyInFather(faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne")
+ geomPublish(initLog.debug, faceFissureExterne, "faceFissureExterne")
+ geomPublishInFather(initLog.debug,faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne")
+ geomPublishInFather(initLog.debug,faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne")
logging.debug("---------------------------- Preparation Maillage du Pipe --------------")
# -----------------------------------------------------------------------
origins.append(vertpx)
normals.append(norm)
# name = "vertcx%d"%i
-# geompy.addToStudyInFather(wireFondFiss, vertcx, name)
+# geomPublishInFather(initLog.debug,wireFondFiss, vertcx, name)
# name = "vertpx%d"%i
-# geompy.addToStudyInFather(wireFondFiss, vertpx, name)
+# geomPublishInFather(initLog.debug,wireFondFiss, vertpx, name)
# name = "plan%d"%i
-# geompy.addToStudyInFather(wireFondFiss, plan, name)
+# geomPublishInFather(initLog.debug,wireFondFiss, plan, name)
# --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau
#logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb)
comp = geompy.MakeCompound(raydisks[k][iddeb:idfin])
name='compoundRay%d'%k
- geompy.addToStudy(comp, name)
+ geomPublish(initLog.debug, comp, name)
else:
idfin = min(len(gptsdisks), numout+1)
iddeb = min(idfin-3, idisk) # il faut 3 rayons pour faire un filling qui suive le fond de fissure
#logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb)
comp = geompy.MakeCompound(raydisks[k][iddeb:idfin])
name='compoundRay%d'%k
- geompy.addToStudy(comp, name)
+ geomPublish(initLog.debug, comp, name)
nappe = geompy.MakeFilling(comp, 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default)
nappes.append(nappe)
name='nappe%d'%k
- geompy.addToStudy(nappe, name)
+ geomPublish(initLog.debug, nappe, name)
facesDebouchantes[i] = True
listNappes.append(nappes)
ednouv.append(ed)
logging.debug(" edges issues de la partition: %s", ednouv)
for ii, ed in enumerate(ednouv):
- geompy.addToStudy(ed, "ednouv%d"%ii)
+ geomPublish(initLog.debug, ed, "ednouv%d"%ii)
[edsorted, minl,maxl] = sortEdges(ednouv)
logging.debug(" longueur edge trouvée: %s", maxl)
edge = edsorted[-1]
edges.append(edge)
name = 'edgeEndPipe%d'%k
- geompy.addToStudy(edge, name)
+ geomPublish(initLog.debug, edge, name)
listEdges.append(edges)
# --- création des points du maillage du pipe sur la face de peau
id = -1 # si id vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face)
centre = ptEdgeFond[idFillingFromBout[i]][id]
name = "centre%d"%id
- geompy.addToStudy(centre, name)
+ geomPublish(initLog.debug, centre, name)
vertPipePeau = ptFisExtPi[idFillingFromBout[i]][id]
- geompy.addToStudyInFather(centre, vertPipePeau, "vertPipePeau")
+ geomPublishInFather(initLog.debug,centre, vertPipePeau, "vertPipePeau")
grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes
edgesCirc = []
for grpEdgesCirc in grpsEdgesCirc:
else:
bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u)
name ="bout%d"%k
- geompy.addToStudyInFather(centre, bout, name)
+ geomPublishInFather(initLog.debug,centre, bout, name)
# enregistrement des points dans la structure
points = []
for j in range(nbsegRad +1):
aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
meshAretesVives = smesh.Mesh(aretesVivesC)
algo1d = meshAretesVives.Segment()
- hypo1d = algo1d.LocalLength(dmoyen/3.0,[],1e-07)
+ hypo1d = algo1d.LocalLength(dmoyen,[],1e-07)
putName(algo1d.GetSubMesh(), "aretesVives")
putName(algo1d, "algo1d_aretesVives")
putName(hypo1d, "hypo1d_aretesVives")
grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
# --- maillage faces de peau
-
+
boutFromIfil = [None for i in range(nbFacesFilling)]
if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
boutFromIfil[idFillingFromBout[0]] = 0
edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False)
groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesFilling)
- geompy.addToStudyInFather(filling, groupEdgesBordPeau , "EdgesBords")
+ geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords")
meshFacePeau = smesh.Mesh(facesDefaut[ifil])
import logging
import salome
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from geomsmesh import smesh
from salome.smesh import smeshBuilder
import SMESH
facePorteFissure = shapeDefaut
WirePorteFondFissure = wiretube
fillingFaceExterne = facesDefaut[0]
- print fillingFaceExterne
- geompy.addToStudy(fillingFaceExterne, "fillingFaceExterne")
+ logging.debug("fillingFaceExterne %s", fillingFaceExterne)
+ geomPublish(initLog.debug, fillingFaceExterne, "fillingFaceExterne")
edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
O, OX, OY, OZ = triedreBase()
# --- partition peau defaut - face de fissure prolongee - wire de fond de fissure prolongée
partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- geompy.addToStudy( partitionPeauFissFond, 'partitionPeauFissFond' )
+ geomPublish(initLog.debug, partitionPeauFissFond, 'partitionPeauFissFond' )
edges = geompy.ExtractShapes(WirePorteFondFissure, geompy.ShapeType["EDGE"], False)
lgmax = lg
imax = i
edgemax = edges[imax]
- geompy.addToStudy(edgemax, 'edgemax')
+ geomPublish(initLog.debug, edgemax, 'edgemax')
centreFondFiss = geompy.MakeVertexOnCurve(edgemax, 0.5)
- geompy.addToStudy(centreFondFiss, 'centreFondFiss')
+ geomPublish(initLog.debug, centreFondFiss, 'centreFondFiss')
tangentFondFiss = geompy.MakeTangentOnCurve(edgemax, 0.5)
- geompy.addToStudy(tangentFondFiss, 'tangentFondFiss')
+ geomPublish(initLog.debug, tangentFondFiss, 'tangentFondFiss')
bord1FondFiss = geompy.MakeVertexOnCurve(edgemax, 0.0)
- geompy.addToStudy(bord1FondFiss, 'bord1FondFiss')
+ geomPublish(initLog.debug, bord1FondFiss, 'bord1FondFiss')
tangentBord1FondFiss = geompy.MakeTangentOnCurve(edgemax, 0.0)
- geompy.addToStudy(tangentBord1FondFiss, 'tangentBord1FondFiss')
+ geomPublish(initLog.debug, tangentBord1FondFiss, 'tangentBord1FondFiss')
bord2FondFiss = geompy.MakeVertexOnCurve(edgemax, 1.0)
- geompy.addToStudy(bord2FondFiss, 'bord2FondFiss')
+ geomPublish(initLog.debug, bord2FondFiss, 'bord2FondFiss')
tangentBord2FondFiss = geompy.MakeTangentOnCurve(edgemax, 1.0)
- geompy.addToStudy(tangentBord2FondFiss, 'tangentBord2FondFiss')
+ geomPublish(initLog.debug, tangentBord2FondFiss, 'tangentBord2FondFiss')
planBord1 = geompy.MakePlane(bord1FondFiss, tangentBord1FondFiss, 3*rayonPipe)
planBord2 = geompy.MakePlane(bord2FondFiss, tangentBord2FondFiss, 3*rayonPipe)
- geompy.addToStudy(planBord1, 'planBord1')
- geompy.addToStudy(planBord2, 'planBord2')
+ geomPublish(initLog.debug, planBord1, 'planBord1')
+ geomPublish(initLog.debug, planBord2, 'planBord2')
[edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
# --- partition peau -face fissure - pipe fond de fissure prolongé
partitionPeauFissByPipe = geompy.MakePartition([facesInside[0], facesOnside[0]], [pipefiss], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- geompy.addToStudy( partitionPeauFissByPipe, 'partitionPeauFissByPipe' )
+ geomPublish(initLog.debug, partitionPeauFissByPipe, 'partitionPeauFissByPipe' )
# --- identification face de peau
[facesPeauFissInside, facesPeauFissOutside, facesPeauFissOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissByPipe, centreFondFiss, "FACE", 0.1, "peauFiss_bord_")
facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFissOnside) # 4 demi disques, une grande face
facePeau = facesPeauSorted[-1] # la plus grande face
- geompy.addToStudyInFather(partitionPeauFissByPipe, facePeau, "facePeau")
+ geomPublishInFather(initLog.debug,partitionPeauFissByPipe, facePeau, "facePeau")
# --- identification edges de bord face peau
edgesBords = []
edgesBords.append(edgepeau)
groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesBords)
- geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords")
+ geomPublishInFather(initLog.debug,facePeau, groupEdgesBordPeau , "EdgesBords")
# --- identification face fissure externe au pipe et edge commune peau fissure
for face in facesPeauFissInside:
if sharedEdges is not None:
faceFiss = face
edgePeauFiss = sharedEdges[0]
- geompy.addToStudyInFather(partitionPeauFissByPipe, faceFiss, "faceFiss")
- geompy.addToStudyInFather(faceFiss, edgePeauFiss, "edgePeauFiss")
- geompy.addToStudyInFather(facePeau, edgePeauFiss, "edgePeauFiss")
+ geomPublishInFather(initLog.debug,partitionPeauFissByPipe, faceFiss, "faceFiss")
+ geomPublishInFather(initLog.debug,faceFiss, edgePeauFiss, "edgePeauFiss")
+ geomPublishInFather(initLog.debug,facePeau, edgePeauFiss, "edgePeauFiss")
break
except:
pass
verticesDemiCerclesPeau = []
for i, edge in enumerate(demiCerclesPeau):
name = "demiCerclePeau_%d"%i
- geompy.addToStudyInFather(facePeau, edge, name)
+ geomPublishInFather(initLog.debug,facePeau, edge, name)
verticesDemiCerclesPeau += geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
verticesDemiCerclesPeau = eliminateDoubles(facePeau, verticesDemiCerclesPeau)
for i, vertex in enumerate(verticesDemiCerclesPeau):
name = "verticesDemiCerclesPeau_%d"%i
- geompy.addToStudyInFather(facePeau, vertex, name)
+ geomPublishInFather(initLog.debug,facePeau, vertex, name)
verticesOutCercles = substractSubShapes(facePeau, verticesDemiCerclesPeau, verticesEdgePeauFiss)
for i, vertex in enumerate(verticesOutCercles):
name = "verticesOutCercles_%d"%i
- geompy.addToStudyInFather(facePeau, vertex, name)
+ geomPublishInFather(initLog.debug,facePeau, vertex, name)
# --- demi cercles regroupés
groupsDemiCerclesPeau = []
group = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(group, demis)
name = "Cercle%d"%i
- geompy.addToStudyInFather(facePeau, group , name)
+ geomPublishInFather(initLog.debug,facePeau, group , name)
groupsDemiCerclesPeau.append(group)
# --- identification edges commune pipe face fissure externe au pipe
if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId:
edgesFaceFissPipe.append(edge)
name = "edgeFaceFissPipe_%d"%len(edgesFaceFissPipe)
- geompy.addToStudyInFather(faceFiss, edge, name)
+ geomPublishInFather(initLog.debug,faceFiss, edge, name)
groupEdgesFaceFissPipe = geompy.CreateGroup(faceFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesFaceFissPipe, edgesFaceFissPipe)
- geompy.addToStudyInFather(faceFiss, groupEdgesFaceFissPipe, "edgesFaceFissPipe")
+ geomPublishInFather(initLog.debug,faceFiss, groupEdgesFaceFissPipe, "edgesFaceFissPipe")
# -----------------------------------------------------------------------------
# --- pipe de fond de fissure
#pipeFondFiss = pipesSorted[-1]
#pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
- geompy.addToStudy( disque, 'disque')
- geompy.addToStudy( wireFondFiss, 'wireFondFiss')
- geompy.addToStudy( pipeFondFiss, 'pipeFondFiss')
+ geomPublish(initLog.debug, disque, 'disque')
+ geomPublish(initLog.debug, wireFondFiss, 'wireFondFiss')
+ geomPublish(initLog.debug, pipeFondFiss, 'pipeFondFiss')
VerticesEndFondFiss = findWireEndVertices(wireFondFiss)
for i, v in enumerate(VerticesEndFondFiss):
name = "vertexEndFondFiss_%d"%i
- geompy.addToStudyInFather(wireFondFiss, v, name)
+ geomPublishInFather(initLog.debug,wireFondFiss, v, name)
VerticesEndPipeFiss = []
for v in VerticesEndFondFiss:
VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v))
for i, v in enumerate(VerticesEndPipeFiss):
name = "vertexEndPipeFiss_%d"%i
- geompy.addToStudyInFather(pipeFondFiss, v, name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, v, name)
- geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[0], "PFOR")
- geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[1], "PFEX")
+ geomPublishInFather(initLog.debug,pipeFondFiss, VerticesEndPipeFiss[0], "PFOR")
+ geomPublishInFather(initLog.debug,pipeFondFiss, VerticesEndPipeFiss[1], "PFEX")
if geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[0]) > geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[1]):
a = verticesOutCercles[0]
verticesOutCercles[0] = verticesOutCercles[1]
verticesOutCercles[1] = a
- geompy.addToStudyInFather(facePeau, verticesOutCercles[0], "THOR")
- geompy.addToStudyInFather(facePeau, verticesOutCercles[1], "THEX")
+ geomPublishInFather(initLog.debug,facePeau, verticesOutCercles[0], "THOR")
+ geomPublishInFather(initLog.debug,facePeau, verticesOutCercles[1], "THEX")
[facesPipeInside, facesPipeOutside, facesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "FACE", 0.1, "pipe_bord_")
[edgesPipeInside, edgesPipeOutside, edgesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "EDGE", 0.1, "pipe_bord_")
centre = geompy.MakeVertexOnSurface(planfiss, 0.5, 0.5)
refpoint = geompy.MakeTranslationVector(centre, geompy.GetNormal(planfiss,centre))
- geompy.addToStudy(refpoint, 'refpoint')
+ geomPublish(initLog.debug, refpoint, 'refpoint')
[facesPipeInplan, facesPipeOutplan, facesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "FACE", 0.1, "pipe_plan_")
[edgesPipeInplan, edgesPipeOutplan, edgesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "EDGE", 0.1, "pipe_plan_")
generFiss.append(edge)
groupGenerFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupGenerFiss, generFiss)
- geompy.addToStudyInFather(pipeFondFiss, groupGenerFiss, "GenFiss")
+ geomPublishInFather(initLog.debug,pipeFondFiss, groupGenerFiss, "GenFiss")
# --- demi cercles externes regroupés
groupsDemiCerclesPipe = []
group = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(group, demis)
name = "Cercle%d"%i
- geompy.addToStudyInFather(pipeFondFiss, group , name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, group , name)
groupsDemiCerclesPipe.append(group)
# --- faces fissure dans le pipe
logging.debug("face found")
facesFissinPipe.append(face)
name = "faceFissInPipe_%d"%i
- geompy.addToStudyInFather(pipeFondFiss, face, name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, face, name)
break
groupFaceFissInPipe = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["FACE"])
geompy.UnionList(groupFaceFissInPipe, facesFissinPipe)
name = "FaceFissInPipe"
- geompy.addToStudyInFather(pipeFondFiss, groupFaceFissInPipe , name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, groupFaceFissInPipe , name)
# --- edges de fond de fissure
logging.debug(" edge %s ", anEdge)
edgesFondFiss.append(anEdge)
name ="edgeFondFissure_%d"%i
- geompy.addToStudyInFather(pipeFondFiss, anEdge, name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, anEdge, name)
groupEdgeFondFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgeFondFiss, edgesFondFiss)
name = "FONDFISS"
- geompy.addToStudyInFather(pipeFondFiss, groupEdgeFondFiss , name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, groupEdgeFondFiss , name)
# -------------------------------------------------------------------------
# --- maillage
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Mon Jun 23 14:49:36 2014
+
+@author: I48174 (Olivier HOAREAU)
+"""
+
+import logging
+import SMESH
+from geomsmesh import smesh
+
+def lookForCorner(maillageAScanner):
+
+ """ Cette fonction permet de scanner la liste de noeuds qui composent le
+ maillage passé en paramètre. On recherche un ou plusieurs coins, ce
+ qui implique les caractéristiques suivantes:
+ - le noeud doit appartenir au moins à trois éléments distincts
+ - chaque élément doit appartenir à un ensemble distinct
+ La fonction renvoie une liste de coins par l'intermédiaire de l'IDs
+ chaque noeud. La liste contient en général au maximum deux coins.
+ """
+
+ logging.info("start")
+
+ allNodeIds = maillageAScanner.GetNodesId() # On stocke tout les noeuds
+ listOfCorners = []
+ for ND in allNodeIds:
+ # On parcours la liste de noeuds
+ listOfElements = maillageAScanner.GetNodeInverseElements(ND)
+ if len(listOfElements) >=3:
+ # On teste le nombre d'éléments qui partagent le même noeud
+ # --- Filtre selon le critère 'coplanar' --- #
+ listOfCriterion = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
+ SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30) \
+ for elem in listOfElements]
+ listOfFilters = [smesh.GetFilterFromCriteria([criteria]) for criteria in listOfCriterion]
+ listOfSets = [maillageAScanner.GetIdsFromFilter(filter) for filter in listOfFilters]
+ if listOfSets.count(listOfSets[0]) == len(listOfSets):
+ # Si toutes les listes d'éléments sont similaires, on retourne
+ # au début pour éviter de travailler sur des éléments inutiles.
+ # Exemple : un noeud appartenant à 4 éléments sur la même face.
+ continue
+ for s in listOfSets:
+ while listOfSets.count(s) > 1:
+ # On supprime tant que la liste d'éléments n'est pas unique.
+ listOfSets.remove(s)
+ if len(listOfSets) >= 3:
+ # Si on a au moins 3 listes d'élements différentes, on considère
+ # qu'il y a présence d'un coin.
+ listOfCorners.append(ND)
+ return listOfCorners
+
+def createLinesFromMesh(maillageSupport):
+
+ """ Cette fonction permet de générer une liste de lignes à partir du
+ maillage support passé en paramètre. On démarre à partir d'un coin
+ simple et on parcourt tout les noeuds pour former une ligne. Soit la
+ figure ci-dessous :
+
+ 1_____4_____7 On part du coin N1, et on cherche les noeuds
+ | | | successifs tels que [1, 2, 3]. Lorsqu'on arrive
+ | 1 | 3 | arrive sur le noeud de fin de ligne N3, on repart
+ | | | du noeud précédent du premier élément (E1), Ã
+ 2_____5_____8 savoir le noeud N4. On suit les noeuds succesifs
+ | | | [4, 5, 6] comme précédemment et ainsi de suite.
+ | 2 | 4 | Lorsqu'on arrive sur le dernier noeud de la
+ | | | dernière ligne, à savoir le noeud N9, on considère
+ 3_____6_____9 que toutes les lignes sont créées.
+
+ La fonction retourne une liste de lignes utilisées par la suite.
+ """
+
+ logging.info("start")
+
+ allNodeIds = maillageSupport.GetNodesId()
+ while len(allNodeIds):
+ nodeIds = allNodeIds
+ for idNode in nodeIds: # rechercher un coin
+ elems = maillageSupport.GetNodeInverseElements(idNode)
+ if len(elems) == 1:
+ # un coin: un noeud, un element quadrangle
+ elem = elems[0]
+ break;
+ idStart = idNode # le noeud de coin
+ elemStart = elem # l'élément quadrangle au coin
+ xyz = maillageSupport.GetNodeXYZ(idStart)
+ logging.debug("idStart %s, coords %s", idStart, str(xyz))
+
+ nodelines =[] # on va constituer une liste de lignes de points
+ nextLine = True
+ ligneFinale = False
+ while nextLine:
+ logging.debug("--- une ligne")
+ idNode = idStart
+ elem = elemStart
+ if ligneFinale:
+ agauche = False # sens de parcours des 4 noeuds d'un quadrangle
+ nextLine = False
+ else:
+ agauche = True
+ ligneIncomplete = True # on commence une ligne de points
+ debutLigne = True
+ nodeline = []
+ elemline = []
+ while ligneIncomplete: # compléter la ligne de points
+ nodeline.append(idNode)
+ allNodeIds.remove(idNode)
+ elemline.append(elem)
+ nodes = maillageSupport.GetElemNodes(elem)
+ i = nodes.index(idNode) # repérer l'index du noeud courant (i) dans l'élément quadrangle (0 a 3)
+ if agauche: # déterminer le noeud suivant (j) et celui opposé (k) dans le quadrangle
+ if i < 3:
+ j = i+1
+ else:
+ j = 0
+ if j < 3:
+ k = j+1
+ else:
+ k = 0
+ else:
+ if i > 0:
+ j = i -1
+ else:
+ j = 3
+ if j > 0:
+ k = j -1
+ else:
+ k = 3
+ isuiv = nodes[j] # noeud suivant
+ iapres = nodes[k] # noeud opposé
+ if debutLigne:
+ debutLigne = False
+ # précédent a trouver, dernière ligne : précédent au lieu de suivant
+ if agauche:
+ if i > 0:
+ iprec = nodes[i -1]
+ else:
+ iprec = nodes[3]
+ idStart = iprec
+ elems3 = maillageSupport.GetNodeInverseElements(iprec)
+ if len(elems3) == 1: # autre coin
+ ligneFinale = True
+ else:
+ for elem3 in elems3:
+ if elem3 != elem:
+ elemStart = elem3
+ break
+ #print nodes, idNode, isuiv, iapres
+ elems1 = maillageSupport.GetNodeInverseElements(isuiv)
+ elems2 = maillageSupport.GetNodeInverseElements(iapres)
+ ligneIncomplete = False
+ for elem2 in elems2:
+ if elems1.count(elem2) and elem2 != elem:
+ ligneIncomplete = True
+ idNode = isuiv
+ elem = elem2
+ break
+ if not ligneIncomplete:
+ nodeline.append(isuiv)
+ allNodeIds.remove(isuiv)
+ logging.debug("nodeline %s", nodeline)
+ logging.debug("elemline %s", elemline)
+ nodelines.append(nodeline)
+
+ # on a constitué une liste de lignes de points connexes
+ logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline))
+
+ return nodelines
+
+def createNewMeshesFromCorner(maillageSupport, listOfCorners):
+
+ """ Cette fonction permet de générer un nouveau maillage plus facile Ã
+ utiliser. On démarre d'un coin et on récupère les trois éléments
+ auquel le noeud appartient. Grâce à un filtre 'coplanar' sur les trois
+ éléments, on peut générer des faces distinctes.
+ """
+
+ logging.info("start")
+
+ tmp = []
+ listOfNewMeshes = []
+ for corner in listOfCorners:
+ elems = maillageSupport.GetNodeInverseElements(corner)
+ for i, elem in enumerate(elems):
+ # --- Filtre selon le critère 'coplanar' --- #
+ critere = smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
+ SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30)
+ filtre = smesh.GetFilterFromCriteria([critere])
+ grp = maillageSupport.GroupOnFilter(SMESH.FACE, 'grp', filtre)
+ # On copie le maillage en fonction du filtre
+ msh = smesh.CopyMesh(grp, 'new_{0}'.format(i + 1), False, True)
+ # On stocke l'ensemble des noeuds du maillage dans tmp
+ # On ajoute le maillage à la liste des nouveaux maillages
+ # seulement s'il n'y est pas déjÃ
+ tmp.append(msh.GetNodesId())
+ if tmp.count(msh.GetNodesId()) <= 1:
+ listOfNewMeshes.append(msh)
+ return listOfNewMeshes
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+import SMESH
+
+from putName import putName
+
+def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, dmoyen):
+ """
+ edges de bord, faces défaut à respecter
+ """
+ logging.info('start')
+
+ aFilterManager = smesh.CreateFilterManager()
+ nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
+ criteres = []
+ unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
+ criteres.append(unCritere)
+ filtre = smesh.GetFilterFromCriteria(criteres)
+ bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
+ smesh.SetName(bordsLibres, 'bordsLibres')
+
+ # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
+ # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
+
+ skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
+ nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
+
+ # --- maillage des éventuelles arêtes vives entre faces reconstruites
+
+ grpAretesVives = None
+ if len(aretesVivesCoupees) > 0:
+ aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
+ meshAretesVives = smesh.Mesh(aretesVivesC)
+ algo1d = meshAretesVives.Segment()
+ hypo1d = algo1d.LocalLength(dmoyen,[],1e-07)
+ putName(algo1d.GetSubMesh(), "aretesVives")
+ putName(algo1d, "algo1d_aretesVives")
+ putName(hypo1d, "hypo1d_aretesVives")
+ isDone = meshAretesVives.Compute()
+ logging.info("aretesVives fini")
+ grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
+ nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
+
+ return (internalBoundary, bordsLibres, grpAretesVives)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from putName import putName
+
+def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
+ meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad):
+ """
+ maillage faces de fissure
+ """
+ logging.info('start')
+
+ meshFaceFiss = smesh.Mesh(faceFissureExterne)
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( areteFaceFissure )
+ hypo2d.SetSecondOrder( 0 )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
+ putName(algo2d.GetSubMesh(), "faceFiss")
+ putName(algo2d, "algo2d_faceFiss")
+ putName(hypo2d, "hypo2d_faceFiss")
+
+ algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
+ hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0)
+ putName(algo1d.GetSubMesh(), "edgeFissPeau")
+ putName(algo1d, "algo1d_edgeFissPeau")
+ putName(hypo1d, "hypo1d_edgeFissPeau")
+
+ isDone = meshFaceFiss.Compute()
+ logging.info("meshFaceFiss fini")
+
+ grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE)
+ grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE)
+ grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
+
+ return (meshFaceFiss, grpFaceFissureExterne, grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from putName import putName
+
+def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
+ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
+ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad):
+ """
+ maillage faces de peau
+ """
+ logging.info('start')
+ nbFacesFilling = len(partitionsPeauFissFond)
+ boutFromIfil = [None for i in range(nbFacesFilling)]
+ if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
+ boutFromIfil[idFillingFromBout[0]] = 0
+ boutFromIfil[idFillingFromBout[1]] = 1
+
+ logging.debug("---------------------------- maillage faces de peau --------------")
+ meshesFacesPeau = []
+ for ifil in range(nbFacesFilling):
+ meshFacePeau = None
+ if partitionsPeauFissFond[ifil] is None: # face de peau maillage sain intacte
+
+ logging.debug("meshFacePeau %d intacte", ifil)
+ # --- edges de bord de la face de filling
+ filling = facesDefaut[ifil]
+ edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False)
+ groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
+ geompy.UnionList(groupEdgesBordPeau, edgesFilling)
+ geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords")
+
+ meshFacePeau = smesh.Mesh(facesDefaut[ifil])
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
+ hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
+ putName(algo1d, "algo1d_bordsLibres", ifil)
+ putName(hypo1d, "hypo1d_bordsLibres", ifil)
+
+ else:
+
+ logging.debug("meshFacePeau %d coupée par la fissure", ifil)
+ facePeau = facesPeaux[ifil] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
+ edgesCircPeau = edCircPeau[ifil] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
+ verticesCircPeau = ptCircPeau[ifil] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ groupEdgesBordPeau = gpedgeBord[ifil] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ bordsVifs = gpedgeVifs[ifil] # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
+ edgesFissurePeau = edFissPeau[ifil] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+
+ meshFacePeau = smesh.Mesh(facePeau)
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
+ hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
+ putName(algo1d, "algo1d_bordsLibres", ifil)
+ putName(hypo1d, "hypo1d_bordsLibres", ifil)
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=geompy.MakeCompound(edgesFissurePeau))
+ hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0)
+ putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil)
+ putName(algo1d, "algo1d_edgePeauFiss", ifil)
+ putName(hypo1d, "hypo1d_edgePeauFiss", ifil)
+
+ if bordsVifs is not None:
+ algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs)
+ hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsVifs", ifil)
+ putName(algo1d, "algo1d_bordsVifs", ifil)
+ putName(hypo1d, "hypo1d_bordsVifs", ifil)
+
+ for i, edgeCirc in enumerate(edgesCircPeau):
+ if edgeCirc is not None:
+ algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc)
+ if boutFromIfil[ifil] is None:
+ hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[i] ],0,0)
+ else:
+ hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[boutFromIfil[ifil]] ],0,0)
+ name = "cercle%d"%i
+ putName(algo1d.GetSubMesh(), name, ifil)
+ putName(algo1d, "algo1d_" + name, ifil)
+ putName(hypo1d, "hypo1d_" + name, ifil)
+
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( dmoyen )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
+ putName(algo2d.GetSubMesh(), "facePeau", ifil)
+ putName(algo2d, "algo2d_facePeau", ifil)
+ putName(hypo2d, "hypo2d_facePeau", ifil)
+
+ isDone = meshFacePeau.Compute()
+ logging.info("meshFacePeau %d fini", ifil)
+ GroupFaces = meshFacePeau.CreateEmptyGroup( SMESH.FACE, "facePeau%d"%ifil )
+ nbAdd = GroupFaces.AddFrom( meshFacePeau.GetMesh() )
+ meshesFacesPeau.append(meshFacePeau)
+
+ return meshesFacesPeau
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- partition du bloc defaut par generatrice, tore et plan fissure
faceFissure = geompy.GetInPlaceByHistory(volDefautPart, facefis)
#ellipsoidep =geompy.GetInPlaceByHistory(volDefautPart, ellipsoide)
- geompy.addToStudy( volDefautPart, 'volDefautPart' )
- geompy.addToStudyInFather( volDefautPart, tore, 'tore' )
- geompy.addToStudyInFather( volDefautPart, faceFissure, 'FACE1' )
- #geompy.addToStudyInFather( volDefautPart, gencnt, 'generatrice' )
+ geomPublish(initLog.debug, volDefautPart, 'volDefautPart' )
+ geomPublishInFather(initLog.debug, volDefautPart, tore, 'tore' )
+ geomPublishInFather(initLog.debug, volDefautPart, faceFissure, 'FACE1' )
+ #geomPublishInFather(initLog.debug, volDefautPart, gencnt, 'generatrice' )
solids = geompy.ExtractShapes(blocp, geompy.ShapeType["SOLID"], True)
vols = []
imaxvol = vols.index(maxvol)
ellipsoidep = solids[imaxvol]
- geompy.addToStudyInFather( volDefautPart, blocp, 'bloc' )
- geompy.addToStudyInFather( volDefautPart, ellipsoidep, 'ellipsoide' )
+ geomPublishInFather(initLog.debug, volDefautPart, blocp, 'bloc' )
+ geomPublishInFather(initLog.debug, volDefautPart, ellipsoidep, 'ellipsoide' )
sharedFaces = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["FACE"])
for i in range(len(sharedFaces)):
name = "faceCommuneEllipsoideBloc_%d"%i
- geompy.addToStudyInFather(blocp, sharedFaces[i], name)
+ geomPublishInFather(initLog.debug,blocp, sharedFaces[i], name)
#sharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
allSharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
sharedEdges.append(allSharedEdges[i])
for i in range(len(sharedEdges)):
name = "edgeCommuneEllipsoideBloc_%d"%i
- geompy.addToStudyInFather(blocp, sharedEdges[i], name)
+ geomPublishInFather(initLog.debug,blocp, sharedEdges[i], name)
facesExternes = []
facesExtBloc = []
faceExt = geompy.GetInPlace(ellipsoidep, faces[i])
if faceExt is not None:
name = "faceExterne_e%d"%i
- geompy.addToStudyInFather(ellipsoidep, faceExt, name)
+ geomPublishInFather(initLog.debug,ellipsoidep, faceExt, name)
facesExternes.append(faceExt)
facesExtElli.append(faceExt)
faceExt = geompy.GetInPlace(blocp, faces[i])
if faceExt is not None:
name = "faceExterne_b%d"%i
- geompy.addToStudyInFather(blocp, faceExt, name)
+ geomPublishInFather(initLog.debug,blocp, faceExt, name)
facesExternes.append(faceExt)
facesExtBloc.append(faceExt)
else:
#extrusionFace = geompy.MakePrismVecH2Ways(faces[i], normal, 0.1)
#extrusionFace = geompy.MakeScaleTransform(extrusionFace, vertex, 1.01)
name = "extrusionFace_b%d"%i
- geompy.addToStudyInFather(blocp, extrusionFace, name)
+ geomPublishInFather(initLog.debug,blocp, extrusionFace, name)
#facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ON)
for j in range(len(facesExt)):
name = "faceExterne_b%d_%d"%(i,j)
- geompy.addToStudyInFather(blocp, facesExt[j], name)
+ geomPublishInFather(initLog.debug,blocp, facesExt[j], name)
facesExternes.append(facesExt[j])
facesExtBloc.append(facesExt[j])
pass
if len(allSharedEdges) > 0:
name = "faceExterne_b%d_%d"%(i,j)
- geompy.addToStudyInFather(blocp, facesBloc[i], name)
+ geomPublishInFather(initLog.debug,blocp, facesBloc[i], name)
facesExternes.append(facesBloc[i])
facesExtBloc.append(facesBloc[i])
aretesInternes += shared
for i in range(len(aretesInternes)):
name = "aretesInternes_%d"%i
- geompy.addToStudyInFather(blocp, aretesInternes[i], name)
+ geomPublishInFather(initLog.debug,blocp, aretesInternes[i], name)
edgesBords = []
for faceExtB in facesExtBloc:
if not isInterne:
edgesBords.append(edges[i])
name = "edgeBord%d"%i
- geompy.addToStudyInFather(blocp,edges[i] , name)
+ geomPublishInFather(initLog.debug,blocp,edges[i] , name)
group = None
if len(edgesBords) > 0:
group = geompy.CreateGroup(blocp, geompy.ShapeType["EDGE"])
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- partition volume sain et bloc, face du bloc recevant la fissure
partieSaine = b
faceBloc = geompy.GetShapesOnShapeAsCompound(volumeSain, volDefaut, geompy.ShapeType["FACE"], GEOM.ST_ON)
- geompy.addToStudy( volumeSainPart, 'volumeSainPart' )
- geompy.addToStudyInFather( volumeSainPart, partieSaine, 'partieSaine' )
- geompy.addToStudyInFather( volumeSainPart, volDefaut, 'volDefaut' )
- geompy.addToStudyInFather( volDefaut, faceBloc, 'faceBloc' )
+ geomPublish(initLog.debug, volumeSainPart, 'volumeSainPart' )
+ geomPublishInFather(initLog.debug, volumeSainPart, partieSaine, 'partieSaine' )
+ geomPublishInFather(initLog.debug, volumeSainPart, volDefaut, 'volDefaut' )
+ geomPublishInFather(initLog.debug, volDefaut, faceBloc, 'faceBloc' )
return volumeSainPart, partieSaine, volDefaut, faceBloc
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import math
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from findWireEndVertices import findWireEndVertices
+from prolongeWire import prolongeWire
+
+def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe):
+ """
+ pipe de fond de fissure, prolongé, partition face fissure par pipe
+ identification des edges communes pipe et face fissure
+ """
+ logging.info('start')
+ shapeDefaut = shapesFissure[0] # faces de fissure, débordant
+ fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
+ centreFondFiss = elementsDefaut[15]
+ tgtCentre = elementsDefaut[16]
+
+ if geompy.NumberOfFaces(shapeDefaut) == 1:
+ plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000)
+ shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ #fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
+ geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe')
+ #geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
+
+ extrem, norms = findWireEndVertices(fondFiss, True)
+ logging.debug("extrem: %s, norm: %s",extrem, norms)
+ cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe)
+ cercle = geompy.MakeRotation(cercle, norms[0], math.pi/3.0 ) # éviter d'avoir l'arête de couture du pipe presque confondue avec la face fissure
+ geomPublish(initLog.debug, cercle, 'cercle')
+ fondFissProlonge = prolongeWire(fondFiss, extrem, norms, 2*rayonPipe)
+ pipeFiss = geompy.MakePipe(cercle, fondFissProlonge)
+ geomPublish(initLog.debug, pipeFiss, 'pipeFiss')
+ partFissPipe = geompy.MakePartition([shapeDefaut, pipeFiss], [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ geomPublish(initLog.debug, partFissPipe, 'partFissPipe')
+ fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut)
+ geomPublish(initLog.debug, fissPipe, 'fissPipe')
+ partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss)
+ geomPublish(initLog.debug, partPipe, 'partPipe')
+
+ edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"])
+ for i, edge in enumerate(edgesPipeFiss):
+ name = "edgePipe%d"%i
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ try:
+ wirePipeFiss = geompy.MakeWire(edgesPipeFiss)
+ except:
+ wirePipeFiss = geompy.MakeCompound(edgesPipeFiss)
+ logging.debug("wirePipeFiss construit sous forme de compound")
+ geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss")
+
+ wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss)
+ edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"])
+ for i, edge in enumerate(edgesFondFiss):
+ name = "edgeFondFiss%d"%i
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ wireFondFiss = geompy.MakeWire(edgesFondFiss)
+ geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
+
+ return (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss)
\ No newline at end of file
from geomsmesh import smesh
import SMESH
+from listOfExtraFunctions import lookForCorner
+from fusionMaillageAttributionDefaut import fusionMaillageDefaut
+
# -----------------------------------------------------------------------------
# --- peau interne du defaut dans le maillage sain
-def peauInterne(fichierMaillage, nomZones):
+def peauInterne(fichierMaillage, shapeDefaut, nomZones):
"""
Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage)
On récupère le volume et la peau de la zone de défaut, les éventuelles faces et arêtes internes de cette zone.
groups = maillageSain.GetGroups()
zoneDefaut = None
for grp in groups:
- #print " ",grp.GetName()
+ logging.debug("groupe %s",grp.GetName())
if grp.GetName() == nomZones + "_vol":
zoneDefaut = grp
break
nbAdded, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ])
internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' )
internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0)
+
+ maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0)
+ listOfCorner = lookForCorner(maillageDefautCible)
+ logging.debug("listOfCorner = %s", listOfCorner)
+ if len(listOfCorner) > 0:
+ logging.info("présence de coins à la surface externe de la zone à reconstruire")
+ zoneDefaut_skin, internalBoundary = fusionMaillageDefaut(maillageSain, maillageDefautCible, internalBoundary, zoneDefaut_skin, shapeDefaut, listOfCorner)
return maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from orderEdgesFromWire import orderEdgesFromWire
# -----------------------------------------------------------------------------
# --- prolongation d'un wire par deux segments tangents
logging.info("start")
if geompy.NumberOfEdges(aWire) > 1:
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
+ uneSeuleEdge = False
else:
edges = [aWire]
+ uneSeuleEdge = True
+ edgesBout = []
for i, v1 in enumerate(extrem):
exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)]
dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)]
dists.sort()
v2 = dists[-1][-1]
- #v2 = geompy.MakeTranslationVectorDistance(v1, norms[i], long)
edge = geompy.MakeEdge(v1, v2)
edges.append(edge)
+ edgesBout.append(edge)
name = "extrem%d"%i
- #geompy.addToStudy(edge,name)
- wireProlonge = geompy.MakeWire(edges)
- geompy.addToStudy(wireProlonge, "wireProlonge")
+ geomPublish(initLog.debug, edge, name)
+ try:
+ wireProlonge = geompy.MakeWire(edges)
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge")
+ except:
+ logging.warning("probleme MakeWire, approche pas a pas")
+ if uneSeuleEdge:
+ edgelist = [aWire]
+ accessList = [0]
+ else:
+ edgelist, accessList = orderEdgesFromWire(aWire)
+ edge1 = edgelist[accessList[0]]
+ if geompy.MinDistance(edgesBout[0], edge1) < 1.e-4 :
+ i0 = 0
+ i1 = 1
+ else:
+ i0 = 1
+ i1 = 0
+ wireProlonge = edgesBout[i0]
+ for i in range(len(edgelist)):
+ wireProlonge = geompy.MakeWire([wireProlonge, edgelist[accessList[i]]])
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge_%d"%i)
+ wireProlonge = geompy.MakeWire([wireProlonge,edgesBout[i1]])
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge")
+ logging.warning("prolongation wire pas a pas OK")
return wireProlonge
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- recherche et classement des edges du tore par propagate
lencomp = []
compounds = geompy.Propagate(tore)
for i in range(len(compounds)):
- #geompy.addToStudyInFather( tore, compounds[i], 'edges' )
+ #geomPublishInFather(initLog.debug, tore, compounds[i], 'edges' )
props = geompy.BasicProperties(compounds[i])
lencomp.append(props[0])
pass
else:
circles.append(compounds[i])
- geompy.addToStudyInFather( tore, diams[0], 'diams0' )
- geompy.addToStudyInFather( tore, diams[1], 'diams1' )
- geompy.addToStudyInFather( tore, circles[0], 'circles0' )
- geompy.addToStudyInFather( tore, circles[1], 'circles1' )
- geompy.addToStudyInFather( tore, geners[0], 'geners' )
+ geomPublishInFather(initLog.debug, tore, diams[0], 'diams0' )
+ geomPublishInFather(initLog.debug, tore, diams[1], 'diams1' )
+ geomPublishInFather(initLog.debug, tore, circles[0], 'circles0' )
+ geomPublishInFather(initLog.debug, tore, circles[1], 'circles1' )
+ geomPublishInFather(initLog.debug, tore, geners[0], 'geners' )
return diams, circles, geners
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import GEOM
import math
import numpy as np
if i == 0:
noeudsBords[0].append(node)
#name = "bord0_%d"%k
- #geompy.addToStudy( node, name )
+ #geomPublish(initLog.debug, node, name )
if i == (nbLignes -1):
noeudsBords[2].append(node)
#name = "bord2_%d"%k
- #geompy.addToStudy( node, name )
+ #geomPublish(initLog.debug, node, name )
if j == 0:
noeudsBords[1].append(node)
#name = "bord1_%d"%k
- #geompy.addToStudy( node, name )
+ #geomPublish(initLog.debug, node, name )
if j == (nbCols -1):
noeudsBords[3].append(node)
#name = "bord3_%d"%k
- #geompy.addToStudy( node, name )
+ #geomPublish(initLog.debug, node, name )
k += 1
curve = geompy.MakeInterpol(nodeList, False, False)
#name = "curve_%d"%i
- #geompy.addToStudy( curve, name )
+ #geomPublish(initLog.debug, curve, name )
if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe
curvconts.append(nodeList)
curves.append(curve)
vecteurDefaut = geompy.MakeVector(vertex, cdg)
if vecteurDefaut is not None:
- geompy.addToStudy(normal, "normFillOrig%d"%iface)
- geompy.addToStudy(vecteurDefaut, "fromInterieur%d"%iface)
+ geomPublish(initLog.debug, normal, "normFillOrig%d"%iface)
+ geomPublish(initLog.debug, vecteurDefaut, "fromInterieur%d"%iface)
if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0:
filling = geompy.ChangeOrientation(filling)
- geompy.addToStudy( filling, "filling%d"%iface )
+ geomPublish(initLog.debug, filling, "filling%d"%iface )
#geompy.ExportBREP(filling, "filling.brep")
iface = iface+1
fillings.append(filling)
curve = geompy.MakeInterpol(nodes, False, False)
curves.append(curve)
fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
- geompy.addToStudy( fillcont, "filcont%d"%icont )
+ geomPublish(initLog.debug, fillcont, "filcont%d"%icont )
fillconts.append(fillcont)
icont = icont+1
pass # --- loop while there are remaining nodes
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+import math
+import numpy as np
+
+def mydot(a):
+ return np.dot(a,a)
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss):
+ """
+ groupe de quadrangles de face transformée en faces géométriques par filling
+ on part de quadrangles définissant une zone a 4 cotés (convexe), et on reconstitue n lignes de p points.
+ Ces n lignes de p points sont transformées en n courbes géométriques,
+ à partir desquelles on reconstitue une surface géométrique.
+ Il peut y avoir plusieurs faces géométriques reconstituées, si on fournit des groupes de quadrangles non connexes.
+ On détecte les angles vifs, pour conserver des arêtes vives délimitant des faces connexes.
+ @param meshQuad : maillages constitué de quadrangles constituant une ou plusieurs zones convexes
+ @return (fillings, noeuds_Bords) : liste de geomObject, listes des bords (bord = liste ordonnée de noeuds (geomObject))
+ """
+ logging.info("start")
+
+ isVecteurDefaut = False
+ if shapeFissureParams.has_key('vecteurDefaut'):
+ isVecteurDefaut = True
+ vecteurDefaut = shapeFissureParams['vecteurDefaut']
+
+ fillings = [] # les faces reconstituées, découpées selon les arêtes vives
+ noeuds_bords = [] #
+ bords_Partages = [] # contient a la fin les courbes correspondant aux arêtes vives
+ fillconts = [] # les faces reconstituées, sans découpage selon les arêtes vives
+ idFilToCont = [] # index face découpée vers face sans découpe
+ iface = 0 # index face découpée
+ icont = 0 # index face continue
+
+ allNodeIds = meshQuad.GetNodesId()
+ while len(allNodeIds):
+ logging.debug("len(allNodeIds): %s ", len(allNodeIds))
+ nodeIds = allNodeIds
+ for idNode in nodeIds: # rechercher un coin
+ elems = meshQuad.GetNodeInverseElements(idNode)
+ if len(elems) == 1:
+ # un coin: un noeud, un element quadrangle
+ elem = elems[0]
+ break;
+ idStart = idNode # le noeud de coin
+ elemStart = elem # l'élément quadrangle au coin
+ xyz = meshQuad.GetNodeXYZ(idStart)
+ logging.debug("idStart %s, coords %s", idStart, str(xyz))
+
+ nodelines =[] # on va constituer une liste de lignes de points
+ nextLine = True
+ ligneFinale = False
+ while nextLine:
+ logging.debug("--- une ligne")
+ idNode = idStart
+ elem = elemStart
+ if ligneFinale:
+ agauche = False # sens de parcours des 4 noeuds d'un quadrangle
+ nextLine = False
+ else:
+ agauche = True
+ ligneIncomplete = True # on commence une ligne de points
+ debutLigne = True
+ nodeline = []
+ elemline = []
+ while ligneIncomplete: # compléter la ligne de points
+ nodeline.append(idNode)
+ allNodeIds.remove(idNode)
+ elemline.append(elem)
+ nodes = meshQuad.GetElemNodes(elem)
+ i = nodes.index(idNode) # repérer l'index du noeud courant (i) dans l'élément quadrangle (0 a 3)
+ if agauche: # déterminer le noeud suivant (j) et celui opposé (k) dans le quadrangle
+ if i < 3:
+ j = i+1
+ else:
+ j = 0
+ if j < 3:
+ k = j+1
+ else:
+ k = 0
+ else:
+ if i > 0:
+ j = i -1
+ else:
+ j = 3
+ if j > 0:
+ k = j -1
+ else:
+ k = 3
+ isuiv = nodes[j] #noeud suivant
+ iapres = nodes[k] #noeud opposé
+ if debutLigne:
+ debutLigne = False
+ # précédent a trouver, dernière ligne : précédent au lieu de suivant
+ if agauche:
+ if i > 0:
+ iprec = nodes[i -1]
+ else:
+ iprec = nodes[3]
+ idStart = iprec
+ elems3 = meshQuad.GetNodeInverseElements(iprec)
+ if len(elems3) == 1: # autre coin
+ ligneFinale = True
+ else:
+ for elem3 in elems3:
+ if elem3 != elem:
+ elemStart = elem3
+ break
+ #print nodes, idNode, isuiv, iapres
+ elems1 = meshQuad.GetNodeInverseElements(isuiv)
+ elems2 = meshQuad.GetNodeInverseElements(iapres)
+ ligneIncomplete = False
+ for elem2 in elems2:
+ if elems1.count(elem2) and elem2 != elem:
+ ligneIncomplete = True
+ idNode = isuiv
+ elem = elem2
+ break
+ if not ligneIncomplete:
+ nodeline.append(isuiv)
+ allNodeIds.remove(isuiv)
+ logging.debug("nodeline %s", nodeline)
+ logging.debug("elemline %s", elemline)
+ nodelines.append(nodeline)
+ logging.debug("nodelines = %s", nodelines)
+ longueur = [len(val) for val in nodelines]
+ logging.debug("longueur = %s", longueur)
+ # on a constitué une liste de lignes de points connexes
+ logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline))
+
+ # stockage des coordonnées dans un tableau numpy
+ mat = np.zeros((len(nodelines), len(nodeline), 3))
+ for i, ligne in enumerate(nodelines):
+ for j, nodeId in enumerate(ligne):
+ mat[i,j] = meshQuad.GetNodeXYZ(nodeId)
+ logging.debug("matrice de coordonnées: \n%s",mat)
+ logging.debug("dimensions %s", mat.shape)
+
+ # recherche d'angles supérieurs a un seuil sur une ligne : angle entre deux vecteurs successifs
+ cosmin = math.cos(math.pi/4.) # TODO: angle reference en paramètre
+ vecx = mat[:, 1:, :] - mat[:, :-1, :] # vecteurs selon direction "x"
+ vx0 = vecx[:, :-1, :] # vecteurs amont
+ vx1 = vecx[:, 1:, :] # vecteurs aval
+ e = np.einsum('ijk,ijk->ij', vx0, vx1) # produit scalaire des vecteurs
+ f = np.apply_along_axis(mydot, 2, vx0) # normes carrées vecteurs amont
+ g = np.apply_along_axis(mydot, 2, vx1) # normes carrées vecteurs aval
+ h = e/(np.sqrt(f*g)) # cosinus
+ ruptureX = h < cosmin # True si angle > reference
+ logging.debug("matrice de rupture X: \n%s",ruptureX)
+ rupX = filter(lambda x: np.prod(ruptureX[:,x]), range(len(nodeline)-2))
+ logging.debug("colonnes de rupture: %s",rupX)
+ # recherche d'angles supérieurs a un seuil sur une colonne : angle entre deux vecteurs successifs
+ vecy = mat[ 1:, :, :] - mat[:-1, :, :] # vecteurs selon direction "y"
+ vy0 = vecy[:-1, :, :] # vecteurs amont
+ vy1 = vecy[ 1:, :, :] # vecteurs aval
+ e = np.einsum('ijk,ijk->ij', vy0, vy1) # produit scalaire des vecteurs
+ f = np.apply_along_axis(mydot, 2, vy0) # normes carrées vecteurs amont
+ g = np.apply_along_axis(mydot, 2, vy1) # normes carrées vecteurs aval
+ h = e/(np.sqrt(f*g)) # cosinus
+ ruptureY = h < cosmin # True si angle > reference
+ logging.debug("matrice de rupture Y: \n%s",ruptureY)
+ rupY = filter(lambda x: np.prod(ruptureY[x, :]), range(len(nodelines)-2))
+ logging.debug("lignes de rupture: %s",rupY)
+ if (len(rupX)*len(rupY)) > 0:
+ logging.critical("""Cas non traité: présence d'angles vifs dans 2 directions,
+ lors de la reconstitution des faces géométriques dans la zone remaillée""")
+
+ mats = []
+ bordsPartages = []
+ if (len(rupX)> 0):
+ rupX.append(mat.shape[1]-1)
+ for i, index in enumerate(rupX):
+ imax = index+2
+ imin = 0
+ if i > 0:
+ imin = rupX[i-1] + 1
+ mats.append(mat[:, imin:imax, :])
+ if imax == mat.shape[1] + 1:
+ ifin = 0
+ else:
+ ifin = imax
+ bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés
+ elif (len(rupY)> 0):
+ rupY.append(mat.shape[0]-1)
+ for i, index in enumerate(rupY):
+ imax = index+2
+ imin = 0
+ if i > 0:
+ imin = rupY[i-1] + 1
+ mats.append(mat[imin:imax, :, :])
+ if imax == mat.shape[0] + 1:
+ ifin = 0
+ else:
+ ifin = imax
+ bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés
+ else:
+ mats.append(mat)
+ bordsPartages.append([0,0]) # les indices différents de 0 correspondent à des bords partagés
+
+ curvconts = []
+ for nmat, amat in enumerate(mats):
+ logging.debug("dimensions matrice %s: %s", nmat, amat.shape)
+ nbLignes = amat.shape[1] # pas de rupture, ou rupture selon des colonnes: on transpose
+ nbCols = amat.shape[0]
+ if len(rupY) > 0 : # rupture selon des lignes: pas de transposition
+ nbLignes = amat.shape[0]
+ nbCols = amat.shape[1]
+ curves = []
+ noeudsBords = []
+ for i in range(4):
+ noeudsBords.append([])
+ k = 0
+ for i in range(nbLignes):
+ nodeList = []
+ for j in range(nbCols):
+ #logging.debug("point[%s,%s] = (%s, %s, %s)",i,j,amat[i,j,0], amat[i,j,1], amat[i,j,2])
+ if len(rupY) > 0 : # pas de transposition
+ node = geompy.MakeVertex(amat[i,j,0], amat[i,j,1], amat[i,j,2])
+ else: # transposition
+ node = geompy.MakeVertex(amat[j,i,0], amat[j,i,1], amat[j,i,2])
+ nodeList.append(node)
+ if i == 0:
+ noeudsBords[0].append(node)
+ #name = "bord0_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if i == (nbLignes -1):
+ noeudsBords[2].append(node)
+ #name = "bord2_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if j == 0:
+ noeudsBords[1].append(node)
+ #name = "bord1_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if j == (nbCols -1):
+ noeudsBords[3].append(node)
+ #name = "bord3_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ k += 1
+ curve = geompy.MakeInterpol(nodeList, False, False)
+ #name = "curve_%d"%i
+ #geomPublish(initLog.debug, curve, name )
+ if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe
+ curvconts.append(nodeList)
+ curves.append(curve)
+ if bordsPartages[nmat][0] :
+ bordsPartages[nmat][0] = curves[0] # la première ligne est un bord partagé
+ else:
+ bordsPartages[nmat][0] = None
+ if bordsPartages[nmat][1] :
+ bordsPartages[nmat][1] = curves[-1] # la dernière ligne est un bord partagé
+ else:
+ bordsPartages[nmat][1] = None
+ filling = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ # --- test orientation filling
+ vertex = geompy.MakeVertexOnSurface(filling, 0.5, 0.5)
+ normal = geompy.GetNormal(filling, vertex)
+
+ if centreFondFiss is not None:
+ logging.debug("orientation filling a l'aide du centre de fond de fissure")
+ vecteurDefaut = geompy.MakeVector(centreFondFiss, vertex)
+
+ if not isVecteurDefaut:
+ pointIn_x = 0.0
+ pointIn_y = 0.0
+ pointIn_z = 0.0
+ pointExplicite = False
+ if shapeFissureParams.has_key('pointIn_x'):
+ pointExplicite = True
+ pointIn_x = shapeFissureParams['pointIn_x']
+ if shapeFissureParams.has_key('pointIn_y'):
+ pointExplicite = True
+ pointIn_y = shapeFissureParams['pointIn_y']
+ if shapeFissureParams.has_key('pointIn_z'):
+ pointExplicite = True
+ pointIn_z = shapeFissureParams['pointIn_z']
+ if pointExplicite:
+ cdg = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
+ logging.debug("orientation filling par point intérieur %s", (pointIn_x, pointIn_y, pointIn_z))
+ vecteurDefaut = geompy.MakeVector(cdg, vertex)
+
+ if shapeFissureParams.has_key('convexe'):
+ isConvexe = shapeFissureParams['convexe']
+ logging.debug("orientation filling par indication de convexité %s", isConvexe)
+ cdg = geompy.MakeCDG(filling)
+ if isConvexe:
+ vecteurDefaut = geompy.MakeVector(cdg, vertex)
+ else:
+ vecteurDefaut = geompy.MakeVector(vertex, cdg)
+
+ if vecteurDefaut is not None:
+ geomPublish(initLog.debug, normal, "normFillOrig%d"%iface)
+ geomPublish(initLog.debug, vecteurDefaut, "fromInterieur%d"%iface)
+ if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0:
+ filling = geompy.ChangeOrientation(filling)
+ geomPublish(initLog.debug, filling, "filling%d"%iface )
+ #geompy.ExportBREP(filling, "filling.brep")
+ iface = iface+1
+ fillings.append(filling)
+ noeuds_bords.append(noeudsBords)
+ idFilToCont.append(icont)
+ bords_Partages += bordsPartages
+ logging.debug("bords_Partages = %s", bords_Partages)
+ pass # --- loop on mats
+ # --- reconstruction des faces continues à partir des listes de noeuds
+ # les courbes doivent suivre la courbure pour éviter les oscillations
+ if icont == iface - 1: # pas de découpe, on garde la même face
+ fillcont = fillings[-1]
+ else:
+ nbLignes = len(curvconts[0])
+ curves = []
+ for i in range(nbLignes):
+ nodes = [curvconts[j][i] for j in range(len(curvconts))]
+ curve = geompy.MakeInterpol(nodes, False, False)
+ curves.append(curve)
+ fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ geomPublish(initLog.debug, fillcont, "filcont%d"%icont )
+ fillconts.append(fillcont)
+ icont = icont+1
+ pass # --- loop while there are remaining nodes
+
+ return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Jun 24 09:14:13 2014
+
+@author: I48174
+"""
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+
+from listOfExtraFunctions import createNewMeshesFromCorner
+from listOfExtraFunctions import createLinesFromMesh
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, centreFondFiss, listOfCorners):
+ """ """
+ # TODO: rédiger la docstring
+
+ logging.info("start")
+
+ #fillings = [[], []]
+ tmpFillings = []
+ noeuds_bords = []
+ #bords_Partages = [[], []]
+ tmpBords = []
+ fillconts = []
+ idFilToCont = []
+
+ facesNonCoupees = []
+ facesCoupees = []
+ aretesNonCoupees = []
+ aretesCoupees = []
+
+ setOfNodes = []
+ setOfLines = []
+ listOfEdges = []
+ # On crée une liste contenant le maillage de chaque face.
+ listOfNewMeshes = createNewMeshesFromCorner(meshQuad, listOfCorners)
+ for msh in listOfNewMeshes:
+ # On crée une liste de noeuds correspondant aux faces suivant
+ # le modèle liste[face][ligne][noeud].
+ lines = createLinesFromMesh(msh, listOfCorners[0])
+ setOfNodes.append(lines)
+
+ for face in setOfNodes:
+ tmpFace = []
+ for line in face:
+ # On possède l'information 'ID' de chaque noeud composant chaque
+ # ligne de chaque face. A partir de l'ID, on crée un vertex. Un
+ # ensemble de vertices constitue une ligne. Un ensemble de lignes
+ # constitue une face.
+ tmpCoords = [meshQuad.GetNodeXYZ(node) for node in line]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ tmpFace.append(line)
+ setOfLines.append(tmpFace)
+
+ for i, face in enumerate(setOfLines):
+ # A partir des lignes de chaque face,
+ # on recrée un objet GEOM temporaire par filling.
+ filling = geompy.MakeFilling(geompy.MakeCompound(face), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
+ tmpFillings.append(filling)
+
+ for face in setOfNodes:
+ # On prend la première ligne qui correspond aux bords partagés
+ listOfEdges.append(face[0])
+
+ for edge in listOfEdges:
+ # On utilise les points de bords pour créer des aretes vives
+ tmpCoords = [meshQuad.GetNodeXYZ(node) for node in list(edge)]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ tmpBords.append(line)
+
+ for i, filling in enumerate(tmpFillings):
+ tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 0, True)
+ tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
+ tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
+ if len(tmpExplodeRef) == len(tmpExplodeNum):
+ geomPublish(initLog.debug, filling, "faceNonCoupee_{0}".format(i + 1))
+ facesNonCoupees.append(filling)
+ else:
+ geomPublish(initLog.debug, filling, "faceCoupee_{0}".format(i + 1))
+ facesCoupees.append(filling)
+ fillings = facesCoupees, facesNonCoupees
+
+ for i, filling in enumerate(tmpBords):
+ tmpPartition = geompy.MakePartition([shapeDefaut], [filling], [], [], geompy.ShapeType["SHELL"], 0, [], 0, True)
+ tmpExplodeRef = geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["VERTEX"], True)
+ tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(tmpPartition, geompy.ShapeType["VERTEX"], True)
+ if len(tmpExplodeRef) == len(tmpExplodeNum):
+ geomPublish(initLog.debug, filling, "areteNonCoupee_{0}".format(i + 1))
+ aretesNonCoupees.append(filling)
+ else:
+ geomPublish(initLog.debug, filling, "areteCoupee_{0}".format(i + 1))
+ aretesCoupees.append(filling)
+ bords_Partages = aretesCoupees, aretesNonCoupees
+
+# TODO: A enlever
+# for i, face in enumerate(setOfLines):
+# for j, line in enumerate(face):
+# geomPublish(initLog.debug, line, 'face{0}_ligne{1}'.format(i + 1, j + 1))
+
+ #TODO: A enlever
+# for i, filling in enumerate(fillings[0]):
+# geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
+# for j, line in enumerate(setOfLines[i]):
+# geompy.addToStudyInFather(filling, line, 'line_{0}'.format(j + 1))
+
+ return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont
+
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from sortFaces import sortFaces
+
+def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
+ """
+ restriction de la face de fissure au domaine solide
+ partition face fissure étendue par fillings
+ """
+ logging.info('start')
+ partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut')
+ facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False)
+ if pointInterne is not None:
+ distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)]
+ distfaces.sort()
+ logging.debug("selection de la face la plus proche du point interne, distance=%s",distfaces[0][0])
+ facesPortFissure = distfaces[0][2]
+ else:
+ facesPartShapeDefautSorted, minSurf, maxSurf = sortFaces(facesPartShapeDefaut) # la face de fissure dans le volume doit être la plus grande
+ logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf)
+ facesPortFissure = facesPartShapeDefautSorted[-1]
+
+ geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
+ return facesPortFissure
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import math
from triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
logging.debug("alpha",alpha)
logging.debug("beta",beta)
if trace:
- geompy.addToStudy( rot1, 'rot1' )
- geompy.addToStudy( axe2, 'axe2' )
- geompy.addToStudy( rot2, 'rot2' )
+ geomPublish(initLog.debug, rot1, 'rot1' )
+ geomPublish(initLog.debug, axe2, 'axe2' )
+ geomPublish(initLog.debug, rot2, 'rot2' )
xyz = geompy.PointCoordinates(point)
trans = geompy.MakeTranslation(rot2, xyz[0], xyz[1], xyz[2])
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- construction d'une shape de dectection des éléments à modifier suite à la la duplication des noeuds de la face fissure (d'un coté de la face)
normal = geompy.GetNormal(face, vertex)
extrusionFaceFissure = geompy.MakePrismVecH(facesFissure, normal, 100)
- geompy.addToStudy(extrusionFaceFissure, "extrusionFaceFissure")
+ geomPublish(initLog.debug, extrusionFaceFissure, "extrusionFaceFissure")
return extrusionFaceFissure, normal
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- tri par longueur des 3 generatrices
gencnt= genx[i]
pass
- geompy.addToStudyInFather( tore, genext, 'genext' )
- geompy.addToStudyInFather( tore, genint, 'genint' )
- geompy.addToStudyInFather( tore, gencnt, 'gencnt' )
+ geomPublishInFather(initLog.debug, tore, genext, 'genext' )
+ geomPublishInFather(initLog.debug, tore, genint, 'genint' )
+ geomPublishInFather(initLog.debug, tore, gencnt, 'gencnt' )
return genext, genint, gencnt
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import math
from triedreBase import triedreBase
Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1)
- #geompy.addToStudy( Vertex_1, 'Vertex_1' )
- #geompy.addToStudy( Vertex_2, 'Vertex_2' )
- #geompy.addToStudy( Vertex_3, 'Vertex_3' )
- #geompy.addToStudy( Arc_1, 'Arc_1' )
- #geompy.addToStudy( generatrice, 'generatrice' )
+ #geomPublish(initLog.debug, Vertex_1, 'Vertex_1' )
+ #geomPublish(initLog.debug, Vertex_2, 'Vertex_2' )
+ #geomPublish(initLog.debug, Vertex_3, 'Vertex_3' )
+ #geomPublish(initLog.debug, Arc_1, 'Arc_1' )
+ #geomPublish(initLog.debug, generatrice, 'generatrice' )
# --- face circulaire sur la generatrice, pour extrusion
Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0)
FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1)
- #geompy.addToStudy( Circle_1, 'Circle_1' )
- #geompy.addToStudy( Rotation_1, 'Rotation_1' )
- #geompy.addToStudy( Translation_1, 'Translation_1' )
- #geompy.addToStudy( FaceGenFiss, 'FaceGenFiss' )
+ #geomPublish(initLog.debug, Circle_1, 'Circle_1' )
+ #geomPublish(initLog.debug, Rotation_1, 'Rotation_1' )
+ #geomPublish(initLog.debug, Translation_1, 'Translation_1' )
+ #geomPublish(initLog.debug, FaceGenFiss, 'FaceGenFiss' )
# --- tore extrude
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3)
FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1)
- #geompy.addToStudyInFather( generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
- #geompy.addToStudy( Line_1, 'Line_1' )
- #geompy.addToStudy( FaceFissure, 'FaceFissure' )
+ #geomPublishInFather(initLog.debug, generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
+ #geomPublish(initLog.debug, Line_1, 'Line_1' )
+ #geomPublish(initLog.debug, FaceFissure, 'FaceFissure' )
# --- tore coupe en 2 demi tore de section 1/2 disque
Plane_1 = geompy.MakePlane(O, OZ, 2000)
Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
- geompy.addToStudy(Pipe1Part , 'Pipe1Part' )
+ geomPublish(initLog.debug, Pipe1Part , 'Pipe1Part' )
return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# --- origine et vecteurs de base
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
+
if not geompy.myStudy.FindObjectByName( 'OX', geompy.ComponentDataType() ):
- geompy.addToStudy( O, 'O' )
- geompy.addToStudy( OX, 'OX' )
- geompy.addToStudy( OY, 'OY' )
- geompy.addToStudy( OZ, 'OZ' )
+ geomPublish(initLog.debug, O, 'O' )
+ geomPublish(initLog.debug, OX, 'OX' )
+ geomPublish(initLog.debug, OY, 'OY' )
+ geomPublish(initLog.debug, OZ, 'OZ' )
return O, OX, OY, OZ
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau):
+ """
+ pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau
+ """
+ logging.info('start')
+
+ j = 0
+ for face in facesInside:
+ edgesPeauFis = []
+ edgesPipeFis = []
+ edgesPipeFnd = []
+ try:
+ edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
+ edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
+ edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"])
+ except:
+ pass
+ if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
+ edgesFissExtPeau.append(edgesPeauFis[0])
+ name="edgesFissExtPeau%d"%j
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name)
+ j += 1
+ return edgesFissExtPeau
\ No newline at end of file
__init__.py
fissureCoude_ihm.py
fissureCoude_plugin.py
+ dialogFissureCoude.dic
)
# --- resources ---
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/ihm)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/ihm)
-SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/ihm)
\ No newline at end of file
+SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/ihm)
<rect>
<x>0</x>
<y>0</y>
- <width>826</width>
- <height>540</height>
+ <width>959</width>
+ <height>618</height>
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Génération de coude avec fissure</string>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
</item>
</layout>
<zorder>verticalSpacer_2</zorder>
- <zorder>horizontalSpacer</zorder>
- <zorder>lb_calcul</zorder>
- <zorder>horizontalSpacer_9</zorder>
</widget>
<resources/>
<connections>
# 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, or (at your option) any later version.
+# 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
initLog.setVerbose()
from blocFissure.gmu import geomsmesh
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
from blocFissure.ihm.fissureCoude_ihm import fissureCoude_ihm
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Insertion de fissure dans un maillage sain</string>
</property>
<property name="toolTip">
<string><html><head/><body><p>Insertion d'un maillage de fissure dans un maillage hexaédrique sain.</p><p>Le maillage sain est fourni sous forme de fichier Med.</p><p>La face de fissure est décrite par une géométrie dans un fichier brep.</p><p>La ou les arêtes de fond de fissure sont données par leurs index dans la face de fissure.</p><p>La procédure identfie des mailles saines à enlever et remailler, construit un maillage régulier rayonnant autour de la ligne de fond de fissure, reconstitue les faces externes en triangles, complète la zone à remailler en tétraèdres.</p></body></html></string>
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'areteArrondieSoudure.med'
+crack = 'fissureSoudureTest.brep'
+
+dicoParams = dict(nomCas = 'casTestCoinTriple',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 30,
+ meshBrep = (5,10),
+ rayonPipe = 5,
+ lenSegPipe = 7,
+ nbSegRad = 8,
+ nbSegCercle = 20,
+ areteFaceFissure = 8)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'areteViveSoudure.med'
+crack = 'fissureSoudureTest.brep'
+
+dicoParams = dict(nomCas = 'casTestCoinTriple',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 30,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'huehue.med'
+crack = 'hue.brep'
+
+dicoParams = dict(nomCas = 'testAubry',
+ maillageSain = '/local00/home/I48174/Bureau/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Bureau/{0}'.format(crack),
+ edgeFissIds = [8],
+ lgInfluence = 0.01,
+ meshBrep = (0.0002,0.003),
+ rayonPipe = 0.005,
+ lenSegPipe = 0.0015,
+ nbSegRad = 8,
+ nbSegCercle = 18,
+ areteFaceFissure = 0.0015)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
SET(plugin_SCRIPTS
__init__.py
cubeAngle.py
+ cubeFin.py
decoupeCylindre.py
disque_perce.py
ellipse_disque.py
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/materielCasTests)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/materielCasTests)
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
Vertex_3 = geompy.MakeVertex(65, 65, 110)
Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Common_1 = geompy.MakeCommon(Disk_1, Box_2)
-geompy.Export(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"), "BREP")
+geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+import salome_notebook
+notebook = salome_notebook.NoteBook(theStudy)
+
+import os
+from blocFissure import gmu
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+cubeFin = geompy.MakeBoxDXDYDZ(200, 200, 200)
+[DEPL,ENCASTR] = geompy.SubShapes(cubeFin, [27, 23])
+origCoin = geompy.MakeVertex(0, 160, 200)
+Disk_1 = geompy.MakeDiskPntVecR(origCoin, OY, 50)
+Translation_1 = geompy.MakeTranslation(origCoin, 0, 10, 0)
+Vector_1 = geompy.MakeVector(origCoin, Translation_1)
+Rotation_1 = geompy.MakeRotation(Disk_1, Vector_1, 90*math.pi/180.0)
+origMilieu = geompy.MakeVertex(0, 160, 100)
+Translation_2 = geompy.MakeTranslationTwoPoints(Rotation_1, origCoin, origMilieu)
+Scale_1 = geompy.MakeScaleAlongAxes(Translation_2, origMilieu, 0.984, 1, 1.2)
+Vertex_1 = geompy.MakeVertex(-10, 160, 210)
+Vertex_2 = geompy.MakeVertex(50, 160, 210)
+Vertex_3 = geompy.MakeVertex(50, 160, -10)
+Vertex_4 = geompy.MakeVertex(-10, 160, -10)
+Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
+Line_2 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
+Line_3 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
+Line_4 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_1)
+cubeFin_Transverse = geompy.MakeFaceWires([Line_1, Line_2, Line_3, Line_4], 1)
+Vertex_5 = geompy.MakeVertex(55, 160, 100)
+Line_1_vertex_3 = geompy.GetSubShape(Line_1, [3])
+Line_3_vertex_2 = geompy.GetSubShape(Line_3, [2])
+Arc_1 = geompy.MakeArc(Line_1_vertex_3, Vertex_5, Line_3_vertex_2)
+Face_1 = geompy.MakeFaceWires([Line_1, Line_3, Line_4, Arc_1], 1)
+cubeFin_Coin = geompy.MakeCommonList([Rotation_1, Face_1], True)
+cubeFin_Milieu = geompy.MakeCommonList([Scale_1, cubeFin_Transverse], True)
+O_1 = geompy.MakeVertex(0, 0, 0)
+OX_1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY_1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ_1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( cubeFin, 'cubeFin' )
+geompy.addToStudyInFather( cubeFin, DEPL, 'DEPL' )
+geompy.addToStudyInFather( cubeFin, ENCASTR, 'ENCASTR' )
+geompy.addToStudy( origCoin, 'origCoin' )
+geompy.addToStudy( Disk_1, 'Disk_1' )
+geompy.addToStudy( Translation_1, 'Translation_1' )
+geompy.addToStudy( Vector_1, 'Vector_1' )
+geompy.addToStudy( Rotation_1, 'Rotation_1' )
+geompy.addToStudy( origMilieu, 'origMilieu' )
+geompy.addToStudy( Translation_2, 'Translation_2' )
+geompy.addToStudy( Scale_1, 'Scale_1' )
+geompy.addToStudy( Vertex_1, 'Vertex_1' )
+geompy.addToStudy( Vertex_2, 'Vertex_2' )
+geompy.addToStudy( Vertex_3, 'Vertex_3' )
+geompy.addToStudy( Vertex_4, 'Vertex_4' )
+geompy.addToStudy( Line_1, 'Line_1' )
+geompy.addToStudy( Line_2, 'Line_2' )
+geompy.addToStudy( Line_3, 'Line_3' )
+geompy.addToStudy( Line_4, 'Line_4' )
+geompy.addToStudy( cubeFin_Transverse, 'cubeFin_Transverse' )
+geompy.addToStudyInFather( Line_1, Line_1_vertex_3, 'Line_1:vertex_3' )
+geompy.addToStudy( Vertex_5, 'Vertex_5' )
+geompy.addToStudyInFather( Line_3, Line_3_vertex_2, 'Line_3:vertex_2' )
+geompy.addToStudy( Arc_1, 'Arc_1' )
+geompy.addToStudy( Face_1, 'Face_1' )
+geompy.addToStudy( cubeFin_Coin, 'cubeFin_Coin' )
+geompy.addToStudy( cubeFin_Milieu, 'cubeFin_Milieu' )
+geompy.addToStudy( O_1, 'O' )
+geompy.addToStudy( OX_1, 'OX' )
+geompy.addToStudy( OY_1, 'OY' )
+geompy.addToStudy( OZ_1, 'OZ' )
+geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"))
+geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"))
+geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"))
+
+###
+### SMESH component
+###
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New(theStudy)
+cubeFin_1 = smesh.Mesh(cubeFin)
+Regular_1D = cubeFin_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = cubeFin_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+Hexa_3D = cubeFin_1.Hexahedron(algo=smeshBuilder.Hexa)
+isDone = cubeFin_1.Compute()
+DEPL_1 = cubeFin_1.GroupOnGeom(DEPL,'DEPL',SMESH.FACE)
+ENCASTR_1 = cubeFin_1.GroupOnGeom(ENCASTR,'ENCASTR',SMESH.FACE)
+
+## Set names of Mesh objects
+smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
+smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
+smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
+smesh.SetName(DEPL_1, 'DEPL')
+smesh.SetName(ENCASTR_1, 'ENCASTR')
+smesh.SetName(cubeFin_1.GetMesh(), 'cubeFin')
+smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
+
+cubeFin_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/cubeFin.med"), 0, SMESH.MED_V2_2, 1 )
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
Divided_Cylinder_1 = geompy.MakeDividedCylinder(145, 800, GEOM.SQUARE)
CylindreSain = geompy.MakeRotation(Divided_Cylinder_1, OZ, 45*math.pi/180.0)
[Compound_1, vertical, radial, Compound_4] = geompy.Propagate(CylindreSain)
-geompy.Export(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"), "BREP")
+geompy.ExportBREP(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"))
Vertex_12 = geompy.MakeVertex(0, -145, 500)
Circle_2 = geompy.MakeCircle(Vertex_12, None, 145)
Face_1 = geompy.MakeFaceWires([Circle_2], 1)
Vertex_13 = geompy.MakeVertex(0, 0, 500)
Disk_1 = geompy.MakeDiskPntVecR(Vertex_13, OZ_1, 170)
FissInCylindre2 = geompy.MakeCommon(Face_1, Disk_1)
-geompy.Export(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"), "BREP")
+geompy.ExportBREP(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( ellipse1, 'ellipse1' )
geompy.addToStudyInFather( ellipse1, fondFiss, 'fondFiss' )
-geompy.Export(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"), "BREP")
+geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"))
if salome.sg.hasDesktop():
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
Vertex_3 = geompy.MakeVertex(120, 2, 60)
Box_1 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Ellipse_disque = geompy.MakeCommon(Box_1, Scale_1)
-geompy.Export(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"), "BREP")
+geompy.ExportBREP(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geompy.addToStudy( Vertex_4, 'Vertex_4' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( ellipse1, 'ellipse1_pb' )
-geompy.Export(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"), "BREP")
+geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"))
if salome.sg.hasDesktop():
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -110.000000 85.000000:T 220.000000 0.000000:T 0.000000 75.000000:T -220.000000 0.000000:WW", geomObj_1 )
SectionDroite = geompy.MakeFaceWires([Sketch_1], 1)
-geompy.Export(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"), "BREP")
+geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geomObj_4 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_2 = geompy.MakeSketcherOnPlane("Sketcher:F 0.000000 0.000000:T 120.000000 0.000000:T 0.000000 100.000000:T -120.000000 20.000000:WW", Plane_2 )
SectionInclinee = geompy.MakeFaceWires([Sketch_2], 1)
-geompy.Export(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFissPb1.brep"), "BREP")
-geompy.Export(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss2.brep"), "BREP")
+geompy.ExportBREP(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFissPb1.brep"))
+geompy.ExportBREP(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss2.brep"))
Vertex_2 = geompy.MakeVertex(110, -10, 200)
Vertex_3 = geompy.MakeVertex(110, 80, 200)
Vertex_4 = geompy.MakeVertex(-10, 80, 200)
Face_1_vertex_9 = geompy.GetSubShape(Face_1, [9])
Line_8 = geompy.MakeLineTwoPnt(Vertex_6, Face_1_vertex_9)
Face_2 = geompy.MakeFaceWires([Line_5, Line_6, Line_7, Line_8], 1)
-geompy.Export(Face_1, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"), "BREP")
-geompy.Export(Face_2, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"), "BREP")
+geompy.ExportBREP(Face_1, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"))
+geompy.ExportBREP(Face_2, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geomObj_3 = geompy.MakeCylinderRH(1450, 8000)
Cylinder_3 = geompy.MakeRotation(geomObj_3, OZ, 180*math.pi/180.0)
Cut_1 = geompy.MakeCut(Partition_1, Cylinder_3)
+geompy.addToStudy( Cut_1, 'Cut_1' )
[faceFiss1] = geompy.SubShapes(Cut_1, [61])
+geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
[Vertex_3,geomObj_4] = geompy.SubShapes(faceFiss1, [4, 5])
Cylinder_4 = geompy.MakeCylinderRH(2000, 4000)
Cylinder_5 = geompy.MakeCylinderRH(1500, 4000)
Common_1 = geompy.MakeCommon(Box_2, Cut_2)
objetSain = geompy.MakePartition([Common_1], [Plane_1, Plane_2, Plane_3], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
[hauteurs, epaisseurs, Compound_3, Compound_4, Compound_5, Compound_6] = geompy.Propagate(objetSain)
-geompy.Export(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"), "BREP")
+geompy.ExportBREP(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Partition_1, 'Partition_1' )
geompy.addToStudy( Cylinder_3, 'Cylinder_3' )
-geompy.addToStudy( Cut_1, 'Cut_1' )
-geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
geompy.addToStudyInFather( faceFiss1, Vertex_3, 'Vertex_3' )
geompy.addToStudy( Cylinder_4, 'Cylinder_4' )
geompy.addToStudy( Cylinder_5, 'Cylinder_5' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
Partition_1 = geompy.MakePartition([Extrusion_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[Face_1,Face_2] = geompy.SubShapes(Partition_1, [18, 13])
FaceFissExt = geompy.MakeFuse(Face_2, Face_1)
-geompy.Export(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2Fiss.brep"), "BREP")
+geompy.ExportBREP(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2Fiss.brep"))
Vertex_2 = geompy.MakeVertex(0, -500, 0)
Vertex_3 = geompy.MakeVertex(400, 500, 800)
objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Rotation_1 = geompy.MakeRotation(Extrusion_1, OX, 180*math.pi/180.0)
Partition_2 = geompy.MakePartition([Rotation_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+geompy.addToStudy( Partition_2, 'Partition_2' )
[FaceFissExtSimple] = geompy.SubShapes(Partition_2, [13])
+geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
Plane_1 = geompy.MakePlaneLCS(None, 2000, 3)
FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
-geompy.Export(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP")
+geompy.ExportBREP(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( Vertex_3, 'Vertex_3' )
geompy.addToStudy( objetSain, 'objetSain' )
geompy.addToStudy( Rotation_1, 'Rotation_1' )
-geompy.addToStudy( Partition_2, 'Partition_2' )
-geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
geompy.addToStudy( Plane_1, 'Plane_1' )
geompy.addToStudy( FaceFissExtCoupe, 'FaceFissExtCoupe' )
from blocFissure.materielCasTests import disque_perce
from blocFissure.materielCasTests import ellipse_disque
from blocFissure.materielCasTests import vis
+from blocFissure.materielCasTests import cubeFin
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
coupe_vis = geompy.MakePartition([Face_1], [Line_1, Line_2, Line_3, Line_4], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[tige, section, tige_haute, rond, tete, section_tete] = geompy.Propagate(coupe_vis)
conge = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"])
-geompy.UnionIDs(conge, [21])
+geompy.UnionIDs(conge, [25])
appui = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"])
-geompy.UnionIDs(appui, [37])
+geompy.UnionIDs(appui, [39])
p_imp = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"])
-geompy.UnionIDs(p_imp, [4])
+geompy.UnionIDs(p_imp, [11])
Vertex_4 = geompy.MakeVertex(11.25, 98.75, 0)
Vertex_5 = geompy.MakeVertexWithRef(Vertex_4, -0.5, 0.5, 0)
Partition_2_vertex_11 = geompy.GetSubShape(Partition_2, [11])
Plane_1 = geompy.MakePlane(Partition_2_vertex_11, OY, 2000)
Partition_3 = geompy.MakePartition([Revolution_1], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
-Vertex_9 = geompy.MakeVertex(0, 99.633883, 8.977320000000001)
+Vertex_9 = geompy.MakeVertex(0, 99.633883, 1.977320000000001)
Vertex_10 = geompy.MakeVertex(0, 99.633883, -8.977320000000001)
Vertex_11 = geompy.MakeVertexWithRef(Vertex_9, 0, 0, -1)
Vertex11x = geompy.MakeVertexWithRef(Vertex_11, 1, 0, 0)
Fissure = geompy.MakeCommonList([Extrusion_1, Revolution_2], True)
fondFiss = geompy.CreateGroup(Fissure, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [9, 7, 4])
-geompy.Export(Fissure, os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP")
+geompy.ExportBREP(Fissure, os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
coupe_vis_1 = smesh.Mesh(coupe_vis)
Regular_1D = coupe_vis_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
-Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = coupe_vis_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+Regular_1D_1 = coupe_vis_1.Segment(geom=tige)
+Nb_Segments_2 = Regular_1D_1.NumberOfSegments(30)
+Regular_1D_2 = coupe_vis_1.Segment(geom=section)
+Nb_Segments_3 = Regular_1D_2.NumberOfSegments(10,1,[ 7, 11, 16, 23 ])
isDone = coupe_vis_1.Compute()
-Nb_Segments_2 = smesh.CreateHypothesis('NumberOfSegments')
-Nb_Segments_2.SetNumberOfSegments( 30 )
-Nb_Segments_2.SetDistrType( 0 )
-status = coupe_vis_1.AddHypothesis(Regular_1D,tige)
-status = coupe_vis_1.AddHypothesis(Nb_Segments_2,tige)
-isDone = coupe_vis_1.Compute()
-Nb_Segments_3 = smesh.CreateHypothesis('NumberOfSegments')
-Nb_Segments_3.SetNumberOfSegments( 10 )
-Nb_Segments_3.SetScaleFactor( 3 )
-Nb_Segments_3.SetReversedEdges( [ ] )
-Nb_Segments_3.SetObjectEntry( "0:1:1:14" )
-status = coupe_vis_1.AddHypothesis(Regular_1D,section)
-status = coupe_vis_1.AddHypothesis(Nb_Segments_3,section)
-coupe_vis_1.Clear()
-isDone = coupe_vis_1.Compute()
-coupe_vis_1.Clear()
-Nb_Segments_3.SetNumberOfSegments( 10 )
-Nb_Segments_3.SetDistrType( 1 )
-Nb_Segments_3.SetScaleFactor( 3 )
-Nb_Segments_3.SetReversedEdges( [ 23, 4, 9, 16 ] )
-Nb_Segments_3.SetObjectEntry( "0:1:1:14" )
-isDone = coupe_vis_1.Compute()
+isDone = coupe_vis_1.SplitQuad( [ 691 ], 1 )
tige_1 = coupe_vis_1.GroupOnGeom(tige,'tige',SMESH.EDGE)
section_1 = coupe_vis_1.GroupOnGeom(section,'section',SMESH.EDGE)
tige_haute_1 = coupe_vis_1.GroupOnGeom(tige_haute,'tige_haute',SMESH.EDGE)
conge_1 = coupe_vis_1.GroupOnGeom(conge,'conge',SMESH.EDGE)
appui_1 = coupe_vis_1.GroupOnGeom(appui,'appui',SMESH.EDGE)
p_imp_1 = coupe_vis_1.GroupOnGeom(p_imp,'p_imp',SMESH.EDGE)
-isDone = coupe_vis_1.SplitQuad( [ 691 ], 1 )
visHex80 = smesh.CopyMesh( coupe_vis_1, 'visHex80', 1, 0)
[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2 ] = visHex80.GetGroups()
-[ tige_rotated, section_rotated, tige_haute_rotated, rond_rotated, tete_rotated, section_tete_rotated, conge_rotated, appui_rotated, p_imp_rotated, tige_top, section_top, tige_haute_top, rond_top, tete_top, section_tete_top, conge_top, appui_top, p_imp_top ] = visHex80.RotationSweepObject2D( visHex80, SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), math.pi/40, 40, 1e-05 ,True)
+[ tige_rotated, section_rotated, tige_haute_rotated, rond_rotated, tete_rotated, section_tete_rotated, conge_rotated, appui_rotated, p_imp_rotated, tige_top, section_top, tige_haute_top, rond_top, tete_top, section_tete_top, conge_top, appui_top, p_imp_top ] = visHex80.RotationSweepObjects( [ visHex80 ], [ visHex80 ], [ visHex80 ], SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), 0.0785398, 40, 1e-05, 1 )
[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top ] = visHex80.GetGroups()
-[ tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.MirrorObject( visHex80, SMESH.AxisStruct( 0, 0, 0, 0, 0, 10 ), SMESH.SMESH_MeshEditor.PLANE ,True,True)
-[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top, tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.GetGroups()
-coincident_nodes_on_part = visHex80.FindCoincidentNodesOnPart( visHex80, 1e-05, [ ] )
-visHex80.MergeNodes(coincident_nodes_on_part)
-equal_elements = visHex80.FindEqualElements( visHex80 )
-visHex80.MergeElements(equal_elements)
-[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top, tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.GetGroups()
-SubMesh_1 = coupe_vis_1.GetSubMesh( tige, 'SubMesh_1' )
-SubMesh_2 = coupe_vis_1.GetSubMesh( section, 'SubMesh_2' )
+Sub_mesh_1 = Regular_1D_1.GetSubMesh()
+Sub_mesh_2 = Regular_1D_2.GetSubMesh()
visHex80.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/visSain.med"), 0, SMESH.MED_V2_2, 1 )
-
+
## Set names of Mesh objects
-smesh.SetName(appui_rotated, 'appui_rotated')
-smesh.SetName(p_imp_rotated, 'p_imp_rotated')
-smesh.SetName(section_tete_rotated, 'section_tete_rotated')
-smesh.SetName(conge_rotated, 'conge_rotated')
-smesh.SetName(rond_rotated, 'rond_rotated')
-smesh.SetName(tete_rotated, 'tete_rotated')
-smesh.SetName(section_rotated, 'section_rotated')
-smesh.SetName(tige_haute_rotated, 'tige_haute_rotated')
-smesh.SetName(tige_rotated, 'tige_rotated')
-smesh.SetName(SubMesh_2, 'SubMesh_2')
-smesh.SetName(SubMesh_1, 'SubMesh_1')
+smesh.SetName(tige_2, 'tige')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
-smesh.SetName(appui_1, 'appui')
-smesh.SetName(p_imp_1, 'p_imp')
+smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
+smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
+smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
smesh.SetName(coupe_vis_1.GetMesh(), 'coupe_vis')
smesh.SetName(visHex80.GetMesh(), 'visHex80')
+smesh.SetName(p_imp_top, 'p_imp_top')
+smesh.SetName(appui_top, 'appui_top')
+smesh.SetName(conge_top, 'conge_top')
+smesh.SetName(section_tete_top, 'section_tete_top')
+smesh.SetName(tete_top, 'tete_top')
+smesh.SetName(rond_top, 'rond_top')
+smesh.SetName(tige_haute_top, 'tige_haute_top')
+smesh.SetName(section_top, 'section_top')
+smesh.SetName(tige_top, 'tige_top')
+smesh.SetName(Sub_mesh_2, 'Sub-mesh_2')
+smesh.SetName(Sub_mesh_1, 'Sub-mesh_1')
+smesh.SetName(p_imp_1, 'p_imp')
+smesh.SetName(p_imp_rotated, 'p_imp_rotated')
+smesh.SetName(appui_1, 'appui')
+smesh.SetName(appui_rotated, 'appui_rotated')
+smesh.SetName(conge_rotated, 'conge_rotated')
+smesh.SetName(section_tete_rotated, 'section_tete_rotated')
+smesh.SetName(tete_rotated, 'tete_rotated')
+smesh.SetName(rond_rotated, 'rond_rotated')
+smesh.SetName(tige_haute_rotated, 'tige_haute_rotated')
+smesh.SetName(section_rotated, 'section_rotated')
smesh.SetName(tige_1, 'tige')
-smesh.SetName(p_imp_2, 'p_imp')
-smesh.SetName(section_1, 'section')
-smesh.SetName(appui_2, 'appui')
+smesh.SetName(tige_rotated, 'tige_rotated')
smesh.SetName(tige_haute_1, 'tige_haute')
-smesh.SetName(conge_2, 'conge')
-smesh.SetName(rond_1, 'rond')
-smesh.SetName(section_tete_2, 'section_tete')
+smesh.SetName(section_1, 'section')
smesh.SetName(tete_1, 'tete')
-smesh.SetName(tete_2, 'tete')
+smesh.SetName(rond_1, 'rond')
+smesh.SetName(conge_1, 'conge')
+smesh.SetName(appui_2, 'appui')
smesh.SetName(section_tete_1, 'section_tete')
+smesh.SetName(p_imp_2, 'p_imp')
+smesh.SetName(section_tete_2, 'section_tete')
+smesh.SetName(conge_2, 'conge')
smesh.SetName(rond_2, 'rond')
-smesh.SetName(conge_1, 'conge')
-smesh.SetName(tige_haute_2, 'tige_haute')
+smesh.SetName(tete_2, 'tete')
smesh.SetName(section_2, 'section')
-smesh.SetName(tige_2, 'tige')
-smesh.SetName(p_imp_top, 'p_imp_top')
-smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
-smesh.SetName(conge_top, 'conge_top')
-smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
-smesh.SetName(appui_top, 'appui_top')
-smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
-smesh.SetName(tete_top, 'tete_top')
-smesh.SetName(section_tete_top, 'section_tete_top')
-smesh.SetName(tige_haute_top, 'tige_haute_top')
-smesh.SetName(rond_top, 'rond_top')
-smesh.SetName(tige_top, 'tige_top')
-smesh.SetName(section_top, 'section_top')
+smesh.SetName(tige_haute_2, 'tige_haute')
+
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
LOG("### resource list:");
std::vector<std::string>* resourceNames = new std::vector<std::string>();
if (resourceList) {
- for (int i = 0; i < resourceList->length(); i++) {
+ for ( size_t i = 0; i < resourceList->length(); i++) {
const char* aResourceName = (*resourceList)[i];
resourceNames->push_back(std::string(aResourceName));
LOG("resource["<<i<<"] = "<<aResourceName);
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
# Copyright (C) 2011-2015 EDF R&D
#
# This library is free software; you can redistribute it and/or