mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-04-14 09:27:26 +05:00
This commit was generated by cvs2git to create branch 'BR-D5-38-2003'.
Cherrypick from master 2005-09-13 11:31:52 UTC jfa <jfa@opencascade.com> 'Rool-back bad changes to the script': idl/SMESH_Hypothesis.idl resources/mesh_hypo_edit.png resources/mesh_merge_elements.png src/Driver/Driver_Mesh.h src/Driver/Driver_SMESHDS_Mesh.h src/DriverMED/DriverMED_Family.cxx src/SMDS/SMDS_EdgePosition.hxx src/SMDS/SMDS_FacePosition.hxx src/SMDS/SMDS_Mesh.cxx src/SMDS/SMDS_Mesh.hxx src/SMDS/SMDS_MeshElement.hxx src/SMDS/SMDS_MeshGroup.hxx src/SMDS/SMDS_MeshNode.hxx src/SMDS/SMDS_MeshObject.hxx src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx src/SMDS/SMDS_Position.hxx src/SMDS/SMDS_SpacePosition.hxx src/SMDS/SMDS_VertexPosition.hxx src/SMESH/SMESH_HypoFilter.cxx src/SMESH/SMESH_HypoFilter.hxx src/SMESHDS/SMESHDS_Mesh.cxx src/SMESHDS/SMESHDS_SubMesh.cxx src/SMESHDS/SMESHDS_SubMesh.hxx src/SMESHGUI/SMESHGUI.cxx src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx src/SMESHGUI/SMESHGUI_GroupDlg.cxx src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx src/SMESHGUI/SMESHGUI_Selection.cxx src/SMESHGUI/SMESHGUI_VTKUtils.cxx src/SMESH_I/SMESH_1D_Algo_i.cxx src/SMESH_I/SMESH_1D_Algo_i.hxx src/SMESH_I/SMESH_2D_Algo_i.cxx src/SMESH_I/SMESH_2D_Algo_i.hxx src/SMESH_I/SMESH_3D_Algo_i.cxx src/SMESH_I/SMESH_3D_Algo_i.hxx src/SMESH_I/SMESH_Mesh_i.hxx src/SMESH_I/SMESH_subMesh_i.cxx src/SMESH_I/SMESH_subMesh_i.hxx src/SMESH_SWIG/Makefile.in src/SMESH_SWIG/SMESH_test.py src/StdMeshers/StdMeshers_Hexa_3D.cxx src/StdMeshers/StdMeshers_MEFISTO_2D.cxx src/StdMeshers/StdMeshers_Penta_3D.cxx src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx src/StdMeshers_I/StdMeshers_LocalLength_i.hxx src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx src/StdMeshers_I/StdMeshers_Propagation_i.cxx src/StdMeshers_I/StdMeshers_Propagation_i.hxx src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx
This commit is contained in:
parent
f4613e1c36
commit
fe629a0269
102
idl/SMESH_Hypothesis.idl
Normal file
102
idl/SMESH_Hypothesis.idl
Normal file
@ -0,0 +1,102 @@
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_Hypothesis.idl
|
||||
// Author : Paul RASCLE, EDF
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_HYPOTHESIS_IDL_
|
||||
#define _SMESH_HYPOTHESIS_IDL_
|
||||
|
||||
#include "SALOME_Exception.idl"
|
||||
#include "SALOME_GenericObj.idl"
|
||||
|
||||
module SMESH
|
||||
{
|
||||
enum Dimension
|
||||
{
|
||||
DIM_1D,
|
||||
DIM_2D,
|
||||
DIM_3D
|
||||
};
|
||||
|
||||
interface SMESH_Hypothesis : SALOME::GenericObj
|
||||
{
|
||||
/*!
|
||||
* Get the Hypothesis typeName
|
||||
*/
|
||||
string GetName();
|
||||
|
||||
/*!
|
||||
* Get the Hypothesis plugin library Name
|
||||
*/
|
||||
string GetLibName();
|
||||
|
||||
/*!
|
||||
* Get the internal Id
|
||||
*/
|
||||
long GetId();
|
||||
|
||||
/*!
|
||||
* Verify whether hypothesis supports given entity type
|
||||
*/
|
||||
boolean IsDimSupported( in Dimension type );
|
||||
};
|
||||
|
||||
typedef sequence<string> ListOfHypothesisName;
|
||||
|
||||
interface SMESH_Algo : SMESH_Hypothesis
|
||||
{
|
||||
/*!
|
||||
* Get list of hypothesis that can be used with this algorithm
|
||||
*/
|
||||
ListOfHypothesisName GetCompatibleHypothesis();
|
||||
|
||||
};
|
||||
|
||||
interface SMESH_1D_Algo : SMESH_Algo
|
||||
{
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
};
|
||||
|
||||
interface SMESH_2D_Algo : SMESH_Algo
|
||||
{
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
};
|
||||
|
||||
interface SMESH_3D_Algo : SMESH_Algo
|
||||
{
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
};
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// Specific Algorithms in separate idl file
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
|
||||
#endif
|
BIN
resources/mesh_hypo_edit.png
Normal file
BIN
resources/mesh_hypo_edit.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 914 B |
BIN
resources/mesh_merge_elements.png
Normal file
BIN
resources/mesh_merge_elements.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 258 B |
63
src/Driver/Driver_Mesh.h
Normal file
63
src/Driver/Driver_Mesh.h
Normal file
@ -0,0 +1,63 @@
|
||||
// SMESH Driver : implementaion of driver for reading and writing
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : Mesh_Reader.h
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _INCLUDE_DRIVER_MESH
|
||||
#define _INCLUDE_DRIVER_MESH
|
||||
|
||||
#include <string>
|
||||
|
||||
#if defined WNT && defined WIN32 && defined DRIVER_EXPORTS
|
||||
#define DRIVER_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define DRIVER_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class DRIVER_WNT_EXPORT Driver_Mesh
|
||||
{
|
||||
public:
|
||||
Driver_Mesh();
|
||||
virtual ~Driver_Mesh(){}
|
||||
|
||||
enum Status {
|
||||
DRS_OK,
|
||||
DRS_EMPTY, // a file contains no mesh with the given name
|
||||
DRS_WARN_RENUMBER, // a file has overlapped ranges of element numbers,
|
||||
// so the numbers from the file are ignored
|
||||
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
|
||||
DRS_FAIL // general failure (exception etc.)
|
||||
};
|
||||
|
||||
virtual Status Perform() = 0;
|
||||
void SetMeshId(int theMeshId);
|
||||
void SetFile(const std::string& theFileName);
|
||||
|
||||
protected:
|
||||
std::string myFile;
|
||||
int myMeshId;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
44
src/Driver/Driver_SMESHDS_Mesh.h
Normal file
44
src/Driver/Driver_SMESHDS_Mesh.h
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
|
||||
#ifndef _INCLUDE_DRIVER_SMESHDS_MESH
|
||||
#define _INCLUDE_DRIVER_SMESHDS_MESH
|
||||
|
||||
#include "Driver_Mesh.h"
|
||||
|
||||
class SMESHDS_Mesh;
|
||||
|
||||
#if defined WNT && defined WIN32 && defined DRIVER_EXPORTS
|
||||
#define DRIVER_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define DRIVER_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class DRIVER_WNT_EXPORT Driver_SMESHDS_Mesh: public Driver_Mesh
|
||||
{
|
||||
public:
|
||||
Driver_SMESHDS_Mesh();
|
||||
void SetMesh(SMESHDS_Mesh *theMesh);
|
||||
|
||||
protected:
|
||||
SMESHDS_Mesh *myMesh;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
390
src/DriverMED/DriverMED_Family.cxx
Normal file
390
src/DriverMED/DriverMED_Family.cxx
Normal file
@ -0,0 +1,390 @@
|
||||
// SMESH DriverMED : tool to split groups on families
|
||||
//
|
||||
// Copyright (C) 2003 CEA
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : DriverMED_Family.cxx
|
||||
// Author : Julia DOROVSKIKH
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "DriverMED_Family.h"
|
||||
#include "MED_Factory.hxx"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Split each group from list <aGroups> on some parts (families)
|
||||
* on the basis of the elements membership in other groups from this list.
|
||||
* Resulting families have no common elements.
|
||||
*/
|
||||
//=============================================================================
|
||||
list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
|
||||
(const map <int, SMESHDS_SubMesh*>& theSubMeshes,
|
||||
const list<SMESHDS_GroupBase*>& theGroups,
|
||||
const bool doGroupOfNodes,
|
||||
const bool doGroupOfEdges,
|
||||
const bool doGroupOfFaces,
|
||||
const bool doGroupOfVolumes)
|
||||
{
|
||||
list<DriverMED_FamilyPtr> aFamilies;
|
||||
|
||||
string anAllNodesGroupName = "Group_Of_All_Nodes";
|
||||
string anAllEdgesGroupName = "Group_Of_All_Edges";
|
||||
string anAllFacesGroupName = "Group_Of_All_Faces";
|
||||
string anAllVolumesGroupName = "Group_Of_All_Volumes";
|
||||
|
||||
// Reserve four ids for families of free elements
|
||||
// (1 - nodes, -1 - edges, -2 - faces, -3 - volumes).
|
||||
// 'Free' means here not belonging to any group.
|
||||
int aNodeFamId = FIRST_NODE_FAMILY;
|
||||
int aElemFamId = FIRST_ELEM_FAMILY;
|
||||
|
||||
// Process sub-meshes
|
||||
map<int, SMESHDS_SubMesh*>::const_iterator aSMIter = theSubMeshes.begin();
|
||||
for (; aSMIter != theSubMeshes.end(); aSMIter++)
|
||||
{
|
||||
if ( aSMIter->second->IsComplexSubmesh() )
|
||||
continue; // submesh containing other submeshs
|
||||
list<DriverMED_FamilyPtr> aSMFams = SplitByType((*aSMIter).second, (*aSMIter).first);
|
||||
list<DriverMED_FamilyPtr>::iterator aSMFamsIter = aSMFams.begin();
|
||||
for (; aSMFamsIter != aSMFams.end(); aSMFamsIter++)
|
||||
{
|
||||
DriverMED_FamilyPtr aFam2 = (*aSMFamsIter);
|
||||
|
||||
list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
|
||||
while (aFamsIter != aFamilies.end())
|
||||
{
|
||||
DriverMED_FamilyPtr aFam1 = *aFamsIter;
|
||||
list<DriverMED_FamilyPtr>::iterator aCurrIter = aFamsIter++;
|
||||
if (aFam1->myType == aFam2->myType)
|
||||
{
|
||||
DriverMED_FamilyPtr aCommon (new DriverMED_Family);
|
||||
aFam1->Split(aFam2, aCommon);
|
||||
if (!aCommon->IsEmpty())
|
||||
{
|
||||
aFamilies.push_back(aCommon);
|
||||
}
|
||||
if (aFam1->IsEmpty())
|
||||
{
|
||||
aFamilies.erase(aCurrIter);
|
||||
}
|
||||
if (aFam2->IsEmpty()) break;
|
||||
}
|
||||
}
|
||||
// The rest elements of family
|
||||
if (!aFam2->IsEmpty())
|
||||
{
|
||||
aFamilies.push_back(aFam2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Process groups
|
||||
list<SMESHDS_GroupBase*>::const_iterator aGroupsIter = theGroups.begin();
|
||||
for (; aGroupsIter != theGroups.end(); aGroupsIter++)
|
||||
{
|
||||
DriverMED_FamilyPtr aFam2 (new DriverMED_Family);
|
||||
aFam2->Init(*aGroupsIter);
|
||||
|
||||
list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
|
||||
while (aFamsIter != aFamilies.end())
|
||||
{
|
||||
DriverMED_FamilyPtr aFam1 = *aFamsIter;
|
||||
list<DriverMED_FamilyPtr>::iterator aCurrIter = aFamsIter++;
|
||||
if (aFam1->myType == aFam2->myType)
|
||||
{
|
||||
DriverMED_FamilyPtr aCommon (new DriverMED_Family);
|
||||
aFam1->Split(aFam2, aCommon);
|
||||
if (!aCommon->IsEmpty())
|
||||
{
|
||||
aFamilies.push_back(aCommon);
|
||||
}
|
||||
if (aFam1->IsEmpty())
|
||||
{
|
||||
aFamilies.erase(aCurrIter);
|
||||
}
|
||||
if (aFam2->IsEmpty()) break;
|
||||
}
|
||||
}
|
||||
// The rest elements of group
|
||||
if (!aFam2->IsEmpty())
|
||||
{
|
||||
aFamilies.push_back(aFam2);
|
||||
}
|
||||
}
|
||||
|
||||
list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
|
||||
for (; aFamsIter != aFamilies.end(); aFamsIter++)
|
||||
{
|
||||
DriverMED_FamilyPtr aFam = *aFamsIter;
|
||||
if (aFam->myType == SMDSAbs_Node) {
|
||||
aFam->SetId(aNodeFamId++);
|
||||
if (doGroupOfNodes) aFam->myGroupNames.insert(anAllNodesGroupName);
|
||||
}
|
||||
else {
|
||||
aFam->SetId(aElemFamId--);
|
||||
if (aFam->myType == SMDSAbs_Edge) {
|
||||
if (doGroupOfEdges) aFam->myGroupNames.insert(anAllEdgesGroupName);
|
||||
}
|
||||
else if (aFam->myType == SMDSAbs_Face) {
|
||||
if (doGroupOfFaces) aFam->myGroupNames.insert(anAllFacesGroupName);
|
||||
}
|
||||
else if (aFam->myType == SMDSAbs_Volume) {
|
||||
if (doGroupOfVolumes) aFam->myGroupNames.insert(anAllVolumesGroupName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create families for elements, not belonging to any group
|
||||
if (doGroupOfNodes)
|
||||
{
|
||||
DriverMED_FamilyPtr aFreeNodesFam (new DriverMED_Family);
|
||||
aFreeNodesFam->SetId(REST_NODES_FAMILY);
|
||||
aFreeNodesFam->myType = SMDSAbs_Node;
|
||||
aFreeNodesFam->myGroupNames.insert(anAllNodesGroupName);
|
||||
aFamilies.push_back(aFreeNodesFam);
|
||||
}
|
||||
|
||||
if (doGroupOfEdges)
|
||||
{
|
||||
DriverMED_FamilyPtr aFreeEdgesFam (new DriverMED_Family);
|
||||
aFreeEdgesFam->SetId(REST_EDGES_FAMILY);
|
||||
aFreeEdgesFam->myType = SMDSAbs_Edge;
|
||||
aFreeEdgesFam->myGroupNames.insert(anAllEdgesGroupName);
|
||||
aFamilies.push_back(aFreeEdgesFam);
|
||||
}
|
||||
|
||||
if (doGroupOfFaces)
|
||||
{
|
||||
DriverMED_FamilyPtr aFreeFacesFam (new DriverMED_Family);
|
||||
aFreeFacesFam->SetId(REST_FACES_FAMILY);
|
||||
aFreeFacesFam->myType = SMDSAbs_Face;
|
||||
aFreeFacesFam->myGroupNames.insert(anAllFacesGroupName);
|
||||
aFamilies.push_back(aFreeFacesFam);
|
||||
}
|
||||
|
||||
if (doGroupOfVolumes)
|
||||
{
|
||||
DriverMED_FamilyPtr aFreeVolumesFam (new DriverMED_Family);
|
||||
aFreeVolumesFam->SetId(REST_VOLUMES_FAMILY);
|
||||
aFreeVolumesFam->myType = SMDSAbs_Volume;
|
||||
aFreeVolumesFam->myGroupNames.insert(anAllVolumesGroupName);
|
||||
aFamilies.push_back(aFreeVolumesFam);
|
||||
}
|
||||
|
||||
DriverMED_FamilyPtr aNullFam (new DriverMED_Family);
|
||||
aNullFam->SetId(0);
|
||||
aNullFam->myType = SMDSAbs_All;
|
||||
aFamilies.push_back(aNullFam);
|
||||
|
||||
return aFamilies;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Create TFamilyInfo for this family
|
||||
*/
|
||||
//=============================================================================
|
||||
MED::PFamilyInfo
|
||||
DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
|
||||
const MED::PMeshInfo& theMeshInfo) const
|
||||
{
|
||||
string aValue;
|
||||
|
||||
ostringstream aStr;
|
||||
|
||||
aStr << "FAM_" << myId;
|
||||
set<string>::const_iterator aGrIter = myGroupNames.begin();
|
||||
for (; aGrIter != myGroupNames.end(); aGrIter++)
|
||||
{
|
||||
aStr << "_" << *aGrIter;
|
||||
}
|
||||
|
||||
aValue = aStr.str();
|
||||
/*
|
||||
MED::TStringVector anAttrDescs (1, ""); // 1 attribute with empty description,
|
||||
MED::TIntVector anAttrIds (1, myId); // Id=0,
|
||||
MED::TIntVector anAttrVals (1, myId); // Value=0
|
||||
*/
|
||||
|
||||
MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
|
||||
aValue,
|
||||
myId,
|
||||
myGroupNames);
|
||||
/*
|
||||
anAttrDescs,
|
||||
anAttrIds,
|
||||
anAttrVals);
|
||||
*/
|
||||
|
||||
// cout << endl;
|
||||
// cout << "Groups: ";
|
||||
// set<string>::iterator aGrIter = myGroupNames.begin();
|
||||
// for (; aGrIter != myGroupNames.end(); aGrIter++)
|
||||
// {
|
||||
// cout << " " << *aGrIter;
|
||||
// }
|
||||
// cout << endl;
|
||||
//
|
||||
// cout << "Elements: ";
|
||||
// set<const SMDS_MeshElement *>::iterator anIter = myElements.begin();
|
||||
// for (; anIter != myElements.end(); anIter++)
|
||||
// {
|
||||
// cout << " " << (*anIter)->GetID();
|
||||
// }
|
||||
// cout << endl;
|
||||
|
||||
return anInfo;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Initialize the tool by SMESHDS_GroupBase
|
||||
*/
|
||||
//=============================================================================
|
||||
void DriverMED_Family::Init (SMESHDS_GroupBase* theGroup)
|
||||
{
|
||||
// Elements
|
||||
myElements.clear();
|
||||
SMDS_ElemIteratorPtr elemIt = theGroup->GetElements();
|
||||
while (elemIt->more())
|
||||
{
|
||||
myElements.insert(elemIt->next());
|
||||
}
|
||||
|
||||
// Type
|
||||
myType = theGroup->GetType();
|
||||
|
||||
// Groups list
|
||||
myGroupNames.clear();
|
||||
myGroupNames.insert(string(theGroup->GetStoreName()));
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Split <theSubMesh> on some parts (families)
|
||||
* on the basis of the elements type.
|
||||
*/
|
||||
//=============================================================================
|
||||
list<DriverMED_FamilyPtr> DriverMED_Family::SplitByType (SMESHDS_SubMesh* theSubMesh,
|
||||
const int theId)
|
||||
{
|
||||
list<DriverMED_FamilyPtr> aFamilies;
|
||||
DriverMED_FamilyPtr aNodesFamily (new DriverMED_Family);
|
||||
DriverMED_FamilyPtr anEdgesFamily (new DriverMED_Family);
|
||||
DriverMED_FamilyPtr aFacesFamily (new DriverMED_Family);
|
||||
DriverMED_FamilyPtr aVolumesFamily (new DriverMED_Family);
|
||||
|
||||
char submeshGrpName[ 30 ];
|
||||
sprintf( submeshGrpName, "SubMesh %d", theId );
|
||||
|
||||
SMDS_NodeIteratorPtr aNodesIter = theSubMesh->GetNodes();
|
||||
while (aNodesIter->more())
|
||||
{
|
||||
const SMDS_MeshNode* aNode = aNodesIter->next();
|
||||
aNodesFamily->AddElement(aNode);
|
||||
}
|
||||
|
||||
SMDS_ElemIteratorPtr anElemsIter = theSubMesh->GetElements();
|
||||
while (anElemsIter->more())
|
||||
{
|
||||
const SMDS_MeshElement* anElem = anElemsIter->next();
|
||||
switch (anElem->GetType())
|
||||
{
|
||||
case SMDSAbs_Edge:
|
||||
anEdgesFamily->AddElement(anElem);
|
||||
break;
|
||||
case SMDSAbs_Face:
|
||||
aFacesFamily->AddElement(anElem);
|
||||
break;
|
||||
case SMDSAbs_Volume:
|
||||
aVolumesFamily->AddElement(anElem);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!aNodesFamily->IsEmpty()) {
|
||||
aNodesFamily->SetType(SMDSAbs_Node);
|
||||
aNodesFamily->AddGroupName(submeshGrpName);
|
||||
aFamilies.push_back(aNodesFamily);
|
||||
}
|
||||
if (!anEdgesFamily->IsEmpty()) {
|
||||
anEdgesFamily->SetType(SMDSAbs_Edge);
|
||||
anEdgesFamily->AddGroupName(submeshGrpName);
|
||||
aFamilies.push_back(anEdgesFamily);
|
||||
}
|
||||
if (!aFacesFamily->IsEmpty()) {
|
||||
aFacesFamily->SetType(SMDSAbs_Face);
|
||||
aFacesFamily->AddGroupName(submeshGrpName);
|
||||
aFamilies.push_back(aFacesFamily);
|
||||
}
|
||||
if (!aVolumesFamily->IsEmpty()) {
|
||||
aVolumesFamily->SetType(SMDSAbs_Volume);
|
||||
aVolumesFamily->AddGroupName(submeshGrpName);
|
||||
aFamilies.push_back(aVolumesFamily);
|
||||
}
|
||||
|
||||
return aFamilies;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Remove from <myElements> elements, common with <by>,
|
||||
* Remove from <by> elements, common with <myElements>,
|
||||
* Create family <common> from common elements, with combined groups list.
|
||||
*/
|
||||
//=============================================================================
|
||||
void DriverMED_Family::Split (DriverMED_FamilyPtr by,
|
||||
DriverMED_FamilyPtr common)
|
||||
{
|
||||
// Elements
|
||||
set<const SMDS_MeshElement *>::iterator anIter = by->myElements.begin();
|
||||
while ( anIter != by->myElements.end())
|
||||
{
|
||||
if (myElements.find(*anIter) != myElements.end())
|
||||
{
|
||||
common->myElements.insert(*anIter);
|
||||
myElements.erase(*anIter);
|
||||
by->myElements.erase(anIter++);
|
||||
}
|
||||
else
|
||||
anIter++;
|
||||
}
|
||||
|
||||
if (!common->IsEmpty())
|
||||
{
|
||||
// Groups list
|
||||
common->myGroupNames = myGroupNames;
|
||||
set<string>::iterator aGrNamesIter = by->myGroupNames.begin();
|
||||
for (; aGrNamesIter != by->myGroupNames.end(); aGrNamesIter++)
|
||||
{
|
||||
common->myGroupNames.insert(*aGrNamesIter);
|
||||
}
|
||||
|
||||
// Type
|
||||
common->myType = myType;
|
||||
}
|
||||
}
|
60
src/SMDS/SMDS_EdgePosition.hxx
Normal file
60
src/SMDS/SMDS_EdgePosition.hxx
Normal file
@ -0,0 +1,60 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_EdgePosition.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_EdgePosition_HeaderFile
|
||||
#define _SMDS_EdgePosition_HeaderFile
|
||||
|
||||
#include "SMDS_Position.hxx"
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_EdgePosition:public SMDS_Position
|
||||
{
|
||||
|
||||
public:
|
||||
SMDS_EdgePosition(const int aEdgeId=0, const double aUParam=0);
|
||||
const virtual double * Coords() const;
|
||||
SMDS_TypeOfPosition GetTypeOfPosition() const;
|
||||
void SetUParameter(double aUparam);
|
||||
double GetUParameter() const;
|
||||
|
||||
private:
|
||||
|
||||
double myUParameter;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
61
src/SMDS/SMDS_FacePosition.hxx
Normal file
61
src/SMDS/SMDS_FacePosition.hxx
Normal file
@ -0,0 +1,61 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_FacePosition.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_FacePosition_HeaderFile
|
||||
#define _SMDS_FacePosition_HeaderFile
|
||||
|
||||
#include "SMDS_Position.hxx"
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_FacePosition:public SMDS_Position
|
||||
{
|
||||
|
||||
public:
|
||||
SMDS_FacePosition(int aFaceId=0, double aUParam=0,
|
||||
double aVParam=0);
|
||||
const virtual double * Coords() const;
|
||||
SMDS_TypeOfPosition GetTypeOfPosition() const;
|
||||
void SetUParameter(double aUparam);
|
||||
void SetVParameter(double aVparam);
|
||||
double GetUParameter() const;
|
||||
double GetVParameter() const;
|
||||
|
||||
private:
|
||||
double myUParameter;
|
||||
double myVParameter;
|
||||
};
|
||||
#endif
|
2203
src/SMDS/SMDS_Mesh.cxx
Normal file
2203
src/SMDS/SMDS_Mesh.cxx
Normal file
File diff suppressed because it is too large
Load Diff
362
src/SMDS/SMDS_Mesh.hxx
Normal file
362
src/SMDS/SMDS_Mesh.hxx
Normal file
@ -0,0 +1,362 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_Mesh.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_Mesh_HeaderFile
|
||||
#define _SMDS_Mesh_HeaderFile
|
||||
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_MeshEdge.hxx"
|
||||
#include "SMDS_MeshFace.hxx"
|
||||
#include "SMDS_MeshVolume.hxx"
|
||||
#include "SMDS_MeshElementIDFactory.hxx"
|
||||
#include "SMDS_ElemIterator.hxx"
|
||||
#include <NCollection_Map.hxx>
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <set>
|
||||
#include <list>
|
||||
|
||||
typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
|
||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
|
||||
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
|
||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;
|
||||
typedef SMDS_Iterator<const SMDS_MeshFace *> SMDS_FaceIterator;
|
||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshFace *> > SMDS_FaceIteratorPtr;
|
||||
typedef SMDS_Iterator<const SMDS_MeshVolume *> SMDS_VolumeIterator;
|
||||
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshVolume *> > SMDS_VolumeIteratorPtr;
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_Mesh:public SMDS_MeshObject{
|
||||
public:
|
||||
|
||||
SMDS_Mesh();
|
||||
|
||||
SMDS_NodeIteratorPtr nodesIterator() const;
|
||||
SMDS_EdgeIteratorPtr edgesIterator() const;
|
||||
SMDS_FaceIteratorPtr facesIterator() const;
|
||||
SMDS_VolumeIteratorPtr volumesIterator() const;
|
||||
SMDS_ElemIteratorPtr elementsIterator() const;
|
||||
|
||||
SMDSAbs_ElementType GetElementType( const int id, const bool iselem ) const;
|
||||
|
||||
SMDS_Mesh *AddSubMesh();
|
||||
|
||||
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
|
||||
virtual SMDS_MeshNode* AddNode(double x, double y, double z);
|
||||
|
||||
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
|
||||
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
int ID);
|
||||
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2);
|
||||
|
||||
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
|
||||
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
int ID);
|
||||
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3);
|
||||
|
||||
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
|
||||
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
int ID);
|
||||
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4);
|
||||
|
||||
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
|
||||
const SMDS_MeshEdge * e2,
|
||||
const SMDS_MeshEdge * e3, int ID);
|
||||
virtual SMDS_MeshFace* AddFace(const SMDS_MeshEdge * e1,
|
||||
const SMDS_MeshEdge * e2,
|
||||
const SMDS_MeshEdge * e3);
|
||||
|
||||
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
|
||||
const SMDS_MeshEdge * e2,
|
||||
const SMDS_MeshEdge * e3,
|
||||
const SMDS_MeshEdge * e4, int ID);
|
||||
virtual SMDS_MeshFace* AddFace(const SMDS_MeshEdge * e1,
|
||||
const SMDS_MeshEdge * e2,
|
||||
const SMDS_MeshEdge * e3,
|
||||
const SMDS_MeshEdge * e4);
|
||||
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4);
|
||||
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
|
||||
int n5, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5);
|
||||
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
|
||||
int n5, int n6, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6,
|
||||
int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6);
|
||||
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
|
||||
int n5, int n6, int n7, int n8, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6,
|
||||
const SMDS_MeshNode * n7,
|
||||
const SMDS_MeshNode * n8,
|
||||
int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2,
|
||||
const SMDS_MeshNode * n3,
|
||||
const SMDS_MeshNode * n4,
|
||||
const SMDS_MeshNode * n5,
|
||||
const SMDS_MeshNode * n6,
|
||||
const SMDS_MeshNode * n7,
|
||||
const SMDS_MeshNode * n8);
|
||||
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
|
||||
const SMDS_MeshFace * f2,
|
||||
const SMDS_MeshFace * f3,
|
||||
const SMDS_MeshFace * f4, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshFace * f1,
|
||||
const SMDS_MeshFace * f2,
|
||||
const SMDS_MeshFace * f3,
|
||||
const SMDS_MeshFace * f4);
|
||||
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
|
||||
const SMDS_MeshFace * f2,
|
||||
const SMDS_MeshFace * f3,
|
||||
const SMDS_MeshFace * f4,
|
||||
const SMDS_MeshFace * f5, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshFace * f1,
|
||||
const SMDS_MeshFace * f2,
|
||||
const SMDS_MeshFace * f3,
|
||||
const SMDS_MeshFace * f4,
|
||||
const SMDS_MeshFace * f5);
|
||||
|
||||
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
|
||||
const SMDS_MeshFace * f2,
|
||||
const SMDS_MeshFace * f3,
|
||||
const SMDS_MeshFace * f4,
|
||||
const SMDS_MeshFace * f5,
|
||||
const SMDS_MeshFace * f6, int ID);
|
||||
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshFace * f1,
|
||||
const SMDS_MeshFace * f2,
|
||||
const SMDS_MeshFace * f3,
|
||||
const SMDS_MeshFace * f4,
|
||||
const SMDS_MeshFace * f5,
|
||||
const SMDS_MeshFace * f6);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<int> nodes_ids,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFaceWithID (std::vector<const SMDS_MeshNode*> nodes,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshFace* AddPolygonalFace (std::vector<const SMDS_MeshNode*> nodes);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
|
||||
(std::vector<int> nodes_ids,
|
||||
std::vector<int> quantities,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolumeWithID
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities,
|
||||
const int ID);
|
||||
|
||||
virtual SMDS_MeshVolume* AddPolyhedralVolume
|
||||
(std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
virtual void RemoveElement(const SMDS_MeshElement * elem,
|
||||
std::list<const SMDS_MeshElement *>& removedElems,
|
||||
std::list<const SMDS_MeshElement *>& removedNodes,
|
||||
const bool removenodes = false);
|
||||
virtual void RemoveElement(const SMDS_MeshElement * elem, bool removenodes = false);
|
||||
virtual void RemoveNode(const SMDS_MeshNode * node);
|
||||
virtual void RemoveEdge(const SMDS_MeshEdge * edge);
|
||||
virtual void RemoveFace(const SMDS_MeshFace * face);
|
||||
virtual void RemoveVolume(const SMDS_MeshVolume * volume);
|
||||
|
||||
virtual bool RemoveFromParent();
|
||||
virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
|
||||
|
||||
static bool ChangeElementNodes(const SMDS_MeshElement * elem,
|
||||
const SMDS_MeshNode * nodes[],
|
||||
const int nbnodes);
|
||||
static bool ChangePolyhedronNodes(const SMDS_MeshElement * elem,
|
||||
std::vector<const SMDS_MeshNode*> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
virtual void Renumber (const bool isNodes, const int startID = 1, const int deltaID = 1);
|
||||
// Renumber all nodes or elements.
|
||||
|
||||
const SMDS_MeshNode *FindNode(int idnode) const;
|
||||
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
|
||||
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
|
||||
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4) const;
|
||||
const SMDS_MeshElement *FindElement(int IDelem) const;
|
||||
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2);
|
||||
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
|
||||
const SMDS_MeshNode *n2,
|
||||
const SMDS_MeshNode *n3);
|
||||
static const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
|
||||
const SMDS_MeshNode *n2,
|
||||
const SMDS_MeshNode *n3,
|
||||
const SMDS_MeshNode *n4);
|
||||
|
||||
const SMDS_MeshFace *FindFace(std::vector<int> nodes_ids) const;
|
||||
static const SMDS_MeshFace* FindFace(std::vector<const SMDS_MeshNode *> nodes);
|
||||
|
||||
int MaxNodeID() const;
|
||||
int MinNodeID() const;
|
||||
int MaxElementID() const;
|
||||
int MinElementID() const;
|
||||
|
||||
|
||||
int NbNodes() const;
|
||||
int NbEdges() const;
|
||||
int NbFaces() const;
|
||||
int NbVolumes() const;
|
||||
int NbSubMesh() const;
|
||||
void DumpNodes() const;
|
||||
void DumpEdges() const;
|
||||
void DumpFaces() const;
|
||||
void DumpVolumes() const;
|
||||
void DebugStats() const;
|
||||
SMDS_Mesh *boundaryFaces();
|
||||
SMDS_Mesh *boundaryEdges();
|
||||
virtual ~SMDS_Mesh();
|
||||
bool hasConstructionEdges();
|
||||
bool hasConstructionFaces();
|
||||
bool hasInverseElements();
|
||||
void setConstructionEdges(bool);
|
||||
void setConstructionFaces(bool);
|
||||
void setInverseElements(bool);
|
||||
|
||||
/*!
|
||||
* Checks if the element is present in mesh.
|
||||
* Useful to determine dead pointers.
|
||||
* Use this function for debug purpose only! Do not check in the code
|
||||
* using it even in _DEBUG_ mode
|
||||
*/
|
||||
bool Contains (const SMDS_MeshElement* elem) const;
|
||||
|
||||
typedef NCollection_Map<SMDS_MeshNode *> SetOfNodes;
|
||||
typedef NCollection_Map<SMDS_MeshEdge *> SetOfEdges;
|
||||
typedef NCollection_Map<SMDS_MeshFace *> SetOfFaces;
|
||||
typedef NCollection_Map<SMDS_MeshVolume *> SetOfVolumes;
|
||||
|
||||
private:
|
||||
SMDS_Mesh(SMDS_Mesh * parent);
|
||||
|
||||
SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
|
||||
const SMDS_MeshNode * node2,
|
||||
const SMDS_MeshNode * node3);
|
||||
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
|
||||
const SMDS_MeshNode * node2,
|
||||
const SMDS_MeshNode * node3,
|
||||
const SMDS_MeshNode * node4);
|
||||
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
|
||||
const SMDS_MeshNode * n2);
|
||||
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
|
||||
const SMDS_MeshNode *n2,
|
||||
const SMDS_MeshNode *n3);
|
||||
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
|
||||
const SMDS_MeshNode *n2,
|
||||
const SMDS_MeshNode *n3,
|
||||
const SMDS_MeshNode *n4);
|
||||
|
||||
bool registerElement(int ID, SMDS_MeshElement * element);
|
||||
|
||||
void addChildrenWithNodes(std::set<const SMDS_MeshElement*>& setOfChildren,
|
||||
const SMDS_MeshElement * element,
|
||||
std::set<const SMDS_MeshElement*>& nodes);
|
||||
|
||||
// Fields PRIVATE
|
||||
|
||||
SetOfNodes myNodes;
|
||||
SetOfEdges myEdges;
|
||||
SetOfFaces myFaces;
|
||||
SetOfVolumes myVolumes;
|
||||
SMDS_Mesh *myParent;
|
||||
std::list<SMDS_Mesh *> myChildren;
|
||||
SMDS_MeshElementIDFactory *myNodeIDFactory;
|
||||
SMDS_MeshElementIDFactory *myElementIDFactory;
|
||||
|
||||
bool myHasConstructionEdges;
|
||||
bool myHasConstructionFaces;
|
||||
bool myHasInverseElements;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
87
src/SMDS/SMDS_MeshElement.hxx
Normal file
87
src/SMDS/SMDS_MeshElement.hxx
Normal file
@ -0,0 +1,87 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_MeshElement.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_MeshElement_HeaderFile
|
||||
#define _SMDS_MeshElement_HeaderFile
|
||||
|
||||
#include "SMDSAbs_ElementType.hxx"
|
||||
#include "SMDS_MeshObject.hxx"
|
||||
#include "SMDS_ElemIterator.hxx"
|
||||
#include "SMDS_MeshElementIDFactory.hxx"
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
class SMDS_MeshNode;
|
||||
class SMDS_MeshEdge;
|
||||
class SMDS_MeshFace;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Base class for elements
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class SMDS_WNT_EXPORT SMDS_MeshElement:public SMDS_MeshObject
|
||||
{
|
||||
|
||||
public:
|
||||
SMDS_ElemIteratorPtr nodesIterator() const;
|
||||
SMDS_ElemIteratorPtr edgesIterator() const;
|
||||
SMDS_ElemIteratorPtr facesIterator() const;
|
||||
virtual SMDS_ElemIteratorPtr
|
||||
elementsIterator(SMDSAbs_ElementType type) const;
|
||||
|
||||
virtual int NbNodes() const;
|
||||
virtual int NbEdges() const;
|
||||
virtual int NbFaces() const;
|
||||
int GetID() const;
|
||||
|
||||
///Return the type of the current element
|
||||
virtual SMDSAbs_ElementType GetType() const = 0;
|
||||
virtual bool IsPoly() const { return false; };
|
||||
|
||||
friend std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *);
|
||||
friend bool SMDS_MeshElementIDFactory::BindID(int ID,SMDS_MeshElement*elem);
|
||||
|
||||
protected:
|
||||
SMDS_MeshElement(int ID=-1);
|
||||
virtual void Print(std::ostream & OS) const;
|
||||
|
||||
private:
|
||||
int myID;
|
||||
};
|
||||
|
||||
#endif
|
87
src/SMDS/SMDS_MeshGroup.hxx
Normal file
87
src/SMDS/SMDS_MeshGroup.hxx
Normal file
@ -0,0 +1,87 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org or email : webmaster@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_MeshGroup.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_MeshGroup_HeaderFile
|
||||
#define _SMDS_MeshGroup_HeaderFile
|
||||
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include <set>
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_MeshGroup:public SMDS_MeshObject
|
||||
{
|
||||
public:
|
||||
SMDS_MeshGroup(const SMDS_Mesh * theMesh,
|
||||
const SMDSAbs_ElementType theType = SMDSAbs_All);
|
||||
const SMDS_MeshGroup * AddSubGroup
|
||||
(const SMDSAbs_ElementType theType = SMDSAbs_All);
|
||||
virtual bool RemoveSubGroup(const SMDS_MeshGroup* theGroup);
|
||||
virtual bool RemoveFromParent();
|
||||
|
||||
const SMDS_Mesh* GetMesh() const { return myMesh; }
|
||||
|
||||
void SetType (const SMDSAbs_ElementType theType);
|
||||
void Clear();
|
||||
void Add(const SMDS_MeshElement * theElem);
|
||||
void Remove(const SMDS_MeshElement * theElem);
|
||||
bool IsEmpty() const { return myElements.empty(); }
|
||||
int Extent() const { return myElements.size(); }
|
||||
|
||||
SMDSAbs_ElementType GetType() const { return myType; }
|
||||
|
||||
bool Contains(const SMDS_MeshElement * theElem) const;
|
||||
|
||||
void InitIterator() const
|
||||
{ const_cast<TIterator&>(myIterator) = myElements.begin(); }
|
||||
|
||||
bool More() const { return myIterator != myElements.end(); }
|
||||
|
||||
const SMDS_MeshElement* Next() const
|
||||
{ return *(const_cast<TIterator&>(myIterator))++; }
|
||||
|
||||
private:
|
||||
SMDS_MeshGroup(SMDS_MeshGroup* theParent,
|
||||
const SMDSAbs_ElementType theType = SMDSAbs_All);
|
||||
|
||||
typedef std::set<const SMDS_MeshElement *>::const_iterator TIterator;
|
||||
const SMDS_Mesh * myMesh;
|
||||
SMDSAbs_ElementType myType;
|
||||
std::set<const SMDS_MeshElement *> myElements;
|
||||
SMDS_MeshGroup * myParent;
|
||||
std::list<const SMDS_MeshGroup*> myChildren;
|
||||
TIterator myIterator;
|
||||
};
|
||||
#endif
|
77
src/SMDS/SMDS_MeshNode.hxx
Normal file
77
src/SMDS/SMDS_MeshNode.hxx
Normal file
@ -0,0 +1,77 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_MeshNode.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_MeshNode_HeaderFile
|
||||
#define _SMDS_MeshNode_HeaderFile
|
||||
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_Position.hxx"
|
||||
#include <NCollection_List.hxx>
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_MeshNode:public SMDS_MeshElement
|
||||
{
|
||||
|
||||
public:
|
||||
SMDS_MeshNode(double x, double y, double z);
|
||||
void Print(std::ostream & OS) const;
|
||||
double X() const;
|
||||
double Y() const;
|
||||
double Z() const;
|
||||
void AddInverseElement(const SMDS_MeshElement * ME);
|
||||
void RemoveInverseElement(const SMDS_MeshElement * parent);
|
||||
void ClearInverseElements();
|
||||
bool emptyInverseElements();
|
||||
SMDS_ElemIteratorPtr GetInverseElementIterator() const;
|
||||
void SetPosition(const SMDS_PositionPtr& aPos);
|
||||
const SMDS_PositionPtr& GetPosition() const;
|
||||
SMDSAbs_ElementType GetType() const;
|
||||
int NbNodes() const;
|
||||
void setXYZ(double x, double y, double z);
|
||||
friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
|
||||
|
||||
protected:
|
||||
SMDS_ElemIteratorPtr
|
||||
elementsIterator(SMDSAbs_ElementType type) const;
|
||||
|
||||
private:
|
||||
double myX, myY, myZ;
|
||||
SMDS_PositionPtr myPosition;
|
||||
NCollection_List<const SMDS_MeshElement*> myInverseElements;
|
||||
};
|
||||
|
||||
#endif
|
48
src/SMDS/SMDS_MeshObject.hxx
Normal file
48
src/SMDS/SMDS_MeshObject.hxx
Normal file
@ -0,0 +1,48 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_MeshObject.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_MeshObject_HeaderFile
|
||||
#define _SMDS_MeshObject_HeaderFile
|
||||
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_MeshObject
|
||||
{
|
||||
public:
|
||||
virtual ~SMDS_MeshObject() {}
|
||||
};
|
||||
#endif
|
190
src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx
Normal file
190
src/SMDS/SMDS_PolyhedralVolumeOfNodes.cxx
Normal file
@ -0,0 +1,190 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "utilities.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=======================================================================
|
||||
//function : Constructor
|
||||
//purpose : Create a volume of many faces
|
||||
//=======================================================================
|
||||
SMDS_PolyhedralVolumeOfNodes::SMDS_PolyhedralVolumeOfNodes
|
||||
(std::vector<const SMDS_MeshNode *> nodes,
|
||||
std::vector<int> quantities)
|
||||
: SMDS_VolumeOfNodes(NULL, NULL, NULL, NULL)
|
||||
{
|
||||
ChangeNodes(nodes, quantities);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMDSAbs_ElementType SMDS_PolyhedralVolumeOfNodes::GetType() const
|
||||
{
|
||||
// return SMDSAbs_PolyhedralVolume;
|
||||
return SMDSAbs_Volume;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (std::vector<const SMDS_MeshNode *> nodes,
|
||||
std::vector<int> quantities)
|
||||
{
|
||||
myNodesByFaces = nodes;
|
||||
myQuantities = quantities;
|
||||
|
||||
// Init fields of parent class
|
||||
int aNbNodes = 0;
|
||||
std::set<const SMDS_MeshNode *> aSet;
|
||||
int nodes_len = nodes.size();
|
||||
for (int j = 0; j < nodes_len; j++) {
|
||||
if (aSet.find(nodes[j]) == aSet.end()) {
|
||||
aSet.insert(nodes[j]);
|
||||
aNbNodes++;
|
||||
}
|
||||
}
|
||||
|
||||
int k = 0;
|
||||
#ifndef WNT
|
||||
const SMDS_MeshNode* aNodes [aNbNodes];
|
||||
#else
|
||||
const SMDS_MeshNode** aNodes = (const SMDS_MeshNode **)new SMDS_MeshNode*[aNbNodes];
|
||||
#endif
|
||||
std::set<const SMDS_MeshNode *>::iterator anIter = aSet.begin();
|
||||
for (; anIter != aSet.end(); anIter++, k++) {
|
||||
aNodes[k] = *anIter;
|
||||
}
|
||||
|
||||
//SMDS_VolumeOfNodes::ChangeNodes(aNodes, aNbNodes);
|
||||
delete [] myNodes;
|
||||
//myNbNodes = nodes.size();
|
||||
myNbNodes = aNbNodes;
|
||||
myNodes = new const SMDS_MeshNode* [myNbNodes];
|
||||
for (int i = 0; i < myNbNodes; i++) {
|
||||
//myNodes[i] = nodes[i];
|
||||
myNodes[i] = aNodes[i];
|
||||
}
|
||||
|
||||
#ifdef WNT
|
||||
delete [] aNodes;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbEdges
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolyhedralVolumeOfNodes::NbEdges() const
|
||||
{
|
||||
int nbEdges = 0;
|
||||
|
||||
for (int ifa = 0; ifa < myQuantities.size(); ifa++) {
|
||||
nbEdges += myQuantities[ifa];
|
||||
}
|
||||
nbEdges /= 2;
|
||||
|
||||
return nbEdges;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFaces
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolyhedralVolumeOfNodes::NbFaces() const
|
||||
{
|
||||
return myQuantities.size();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbFaceNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMDS_PolyhedralVolumeOfNodes::NbFaceNodes (const int face_ind) const
|
||||
{
|
||||
if (face_ind < 1 || myQuantities.size() < face_ind)
|
||||
return 0;
|
||||
return myQuantities[face_ind - 1];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetFaceNode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
const SMDS_MeshNode* SMDS_PolyhedralVolumeOfNodes::GetFaceNode (const int face_ind,
|
||||
const int node_ind) const
|
||||
{
|
||||
if (node_ind < 1 || NbFaceNodes(face_ind) < node_ind)
|
||||
return NULL;
|
||||
|
||||
int i, first_node = 0;
|
||||
for (i = 0; i < face_ind - 1; i++) {
|
||||
first_node += myQuantities[i];
|
||||
}
|
||||
|
||||
return myNodesByFaces[first_node + node_ind - 1];
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Print
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMDS_PolyhedralVolumeOfNodes::Print (ostream & OS) const
|
||||
{
|
||||
OS << "polyhedral volume <" << GetID() << "> : ";
|
||||
|
||||
int faces_len = myQuantities.size();
|
||||
//int nodes_len = myNodesByFaces.size();
|
||||
int cur_first_node = 0;
|
||||
|
||||
int i, j;
|
||||
for (i = 0; i < faces_len; i++) {
|
||||
OS << "face_" << i << " (";
|
||||
for (j = 0; j < myQuantities[i] - 1; j++) {
|
||||
OS << myNodesByFaces[cur_first_node + j] << ",";
|
||||
}
|
||||
OS << myNodesByFaces[cur_first_node + j] << ") ";
|
||||
cur_first_node += myQuantities[i];
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ChangeNodes
|
||||
//purpose : usage disabled
|
||||
//=======================================================================
|
||||
bool SMDS_PolyhedralVolumeOfNodes::ChangeNodes (const SMDS_MeshNode* nodes[],
|
||||
const int nbNodes)
|
||||
{
|
||||
return false;
|
||||
}
|
77
src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx
Normal file
77
src/SMDS/SMDS_PolyhedralVolumeOfNodes.hxx
Normal file
@ -0,0 +1,77 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_PolyhedralVolumeOfNodes.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_PolyhedralVolumeOfNodes_HeaderFile
|
||||
#define _SMDS_PolyhedralVolumeOfNodes_HeaderFile
|
||||
|
||||
#include "SMDS_VolumeOfNodes.hxx"
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
class SMDS_WNT_EXPORT SMDS_PolyhedralVolumeOfNodes:public SMDS_VolumeOfNodes
|
||||
{
|
||||
public:
|
||||
SMDS_PolyhedralVolumeOfNodes (std::vector<const SMDS_MeshNode *> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
//virtual ~SMDS_PolyhedralVolumeOfNodes();
|
||||
|
||||
virtual SMDSAbs_ElementType GetType() const;
|
||||
virtual bool IsPoly() const { return true; };
|
||||
|
||||
bool ChangeNodes (std::vector<const SMDS_MeshNode *> nodes,
|
||||
std::vector<int> quantities);
|
||||
|
||||
//virtual int NbNodes() const;
|
||||
virtual int NbEdges() const;
|
||||
virtual int NbFaces() const;
|
||||
|
||||
int NbFaceNodes (const int face_ind) const;
|
||||
// 1 <= face_ind <= NbFaces()
|
||||
|
||||
const SMDS_MeshNode* GetFaceNode (const int face_ind, const int node_ind) const;
|
||||
// 1 <= face_ind <= NbFaces()
|
||||
// 1 <= node_ind <= NbFaceNodes()
|
||||
|
||||
virtual void Print (std::ostream & OS) const;
|
||||
|
||||
protected:
|
||||
//virtual SMDS_ElemIteratorPtr elementsIterator (SMDSAbs_ElementType type) const;
|
||||
|
||||
private:
|
||||
// usage disabled
|
||||
bool ChangeNodes (const SMDS_MeshNode* nodes[],
|
||||
const int nbNodes);
|
||||
|
||||
private:
|
||||
std::vector<const SMDS_MeshNode *> myNodesByFaces;
|
||||
std::vector<int> myQuantities;
|
||||
};
|
||||
|
||||
#endif
|
68
src/SMDS/SMDS_Position.hxx
Normal file
68
src/SMDS/SMDS_Position.hxx
Normal file
@ -0,0 +1,68 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_Position.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_Position_HeaderFile
|
||||
#define _SMDS_Position_HeaderFile
|
||||
|
||||
#include "SMDS_TypeOfPosition.hxx"
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMDS_Position;
|
||||
typedef boost::shared_ptr<SMDS_Position> SMDS_PositionPtr;
|
||||
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_Position
|
||||
{
|
||||
|
||||
public:
|
||||
const virtual double * Coords() const = 0;
|
||||
virtual SMDS_TypeOfPosition GetTypeOfPosition() const = 0;
|
||||
virtual int GetDim() const;
|
||||
void SetShapeId(int aShapeId);
|
||||
int GetShapeId() const;
|
||||
virtual ~SMDS_Position() {}
|
||||
|
||||
protected:
|
||||
SMDS_Position(int aShapeId);
|
||||
|
||||
private:
|
||||
int myShapeId;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
57
src/SMDS/SMDS_SpacePosition.hxx
Normal file
57
src/SMDS/SMDS_SpacePosition.hxx
Normal file
@ -0,0 +1,57 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_SpacePosition.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_SpacePosition_HeaderFile
|
||||
#define _SMDS_SpacePosition_HeaderFile
|
||||
|
||||
#include "SMDS_Position.hxx"
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_SpacePosition:public SMDS_Position
|
||||
{
|
||||
|
||||
public:
|
||||
SMDS_SpacePosition(double x=0, double y=0, double z=0);
|
||||
const virtual double * Coords() const;
|
||||
virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const;
|
||||
inline void SetCoords(const double x, const double y, const double z);
|
||||
static SMDS_PositionPtr originSpacePosition();
|
||||
private:
|
||||
double myCoords[3];
|
||||
};
|
||||
|
||||
#endif
|
53
src/SMDS/SMDS_VertexPosition.hxx
Normal file
53
src/SMDS/SMDS_VertexPosition.hxx
Normal file
@ -0,0 +1,53 @@
|
||||
// SMESH SMDS : implementaion of Salome mesh data structure
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMDS_VertexPosition.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMDS_VertexPosition_HeaderFile
|
||||
#define _SMDS_VertexPosition_HeaderFile
|
||||
|
||||
#include "SMDS_Position.hxx"
|
||||
|
||||
//#ifdef WNT
|
||||
//#include <SALOME_WNT.hxx>
|
||||
//#else
|
||||
//#define SALOME_WNT_EXPORT
|
||||
//#endif
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMDS_EXPORTS
|
||||
#define SMDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMDS_WNT_EXPORT SMDS_VertexPosition:public SMDS_Position
|
||||
{
|
||||
|
||||
public:
|
||||
SMDS_TypeOfPosition GetTypeOfPosition() const;
|
||||
SMDS_VertexPosition(int aVertexId=0);
|
||||
const double *Coords() const;
|
||||
};
|
||||
|
||||
#endif
|
305
src/SMESH/SMESH_HypoFilter.cxx
Normal file
305
src/SMESH/SMESH_HypoFilter.cxx
Normal file
@ -0,0 +1,305 @@
|
||||
// SMESH SMESH : implementaion of SMESH idl descriptions
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_HypoFilter.cxx
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESH_HypoFilter.hxx"
|
||||
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
#include "SMESH_subMesh.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NamePredicate::Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESH_HypoFilter::NamePredicate::IsOk (const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& /*aShape*/ ) const
|
||||
{
|
||||
return ( _name == aHyp->GetName() );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TypePredicate::Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMESH_HypoFilter::TypePredicate::Value( const SMESH_Hypothesis* aHyp ) const
|
||||
{
|
||||
return aHyp->GetType();
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : DimPredicate::Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMESH_HypoFilter::DimPredicate::Value( const SMESH_Hypothesis* aHyp ) const
|
||||
{
|
||||
return aHyp->GetDim();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ApplicablePredicate::IsOk
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESH_HypoFilter::ApplicablePredicate::IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& /*aShape*/) const
|
||||
{
|
||||
return SMESH_subMesh::IsApplicableHypotesis( aHyp, (TopAbs_ShapeEnum)_shapeType );
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : ApplicablePredicate::ApplicablePredicate
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter::ApplicablePredicate::ApplicablePredicate( const TopoDS_Shape& theShape )
|
||||
{
|
||||
_shapeType = ( theShape.IsNull() ? TopAbs_SHAPE : theShape.ShapeType());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : InstancePredicate::IsOk
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESH_HypoFilter::InstancePredicate::IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& /*aShape*/) const
|
||||
{
|
||||
return _hypo == aHyp;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAssignedToPredicate::IsOk
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESH_HypoFilter::IsAssignedToPredicate::IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const
|
||||
{
|
||||
return ( !_mainShape.IsNull() && !aShape.IsNull() && _mainShape.IsSame( aShape ));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SMESH_HypoFilter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter::SMESH_HypoFilter()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : SMESH_HypoFilter
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter::SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNagate )
|
||||
{
|
||||
add( notNagate ? AND : AND_NOT, aPredicate );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : And
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter & SMESH_HypoFilter::And( SMESH_HypoPredicate* aPredicate )
|
||||
{
|
||||
add( AND, aPredicate );
|
||||
return *this;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AndNot
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter & SMESH_HypoFilter::AndNot( SMESH_HypoPredicate* aPredicate )
|
||||
{
|
||||
add( AND_NOT, aPredicate );
|
||||
return *this;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Or
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter & SMESH_HypoFilter::Or( SMESH_HypoPredicate* aPredicate )
|
||||
{
|
||||
add( OR, aPredicate );
|
||||
return *this;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OrNot
|
||||
//purpose : Return predicates
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter & SMESH_HypoFilter::OrNot( SMESH_HypoPredicate* aPredicate )
|
||||
{
|
||||
add( OR_NOT, aPredicate );
|
||||
return *this;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Is
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::Is(const SMESH_Hypothesis* theHypo)
|
||||
{
|
||||
return new InstancePredicate( theHypo );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAlgo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::IsAlgo()
|
||||
{
|
||||
return new TypePredicate( MORE, SMESHDS_Hypothesis::PARAM_ALGO );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsGlobal
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::IsGlobal(const TopoDS_Shape& theMainShape)
|
||||
{
|
||||
return new IsAssignedToPredicate( theMainShape );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsAssignedTo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::IsAssignedTo(const TopoDS_Shape& theShape)
|
||||
{
|
||||
return new IsAssignedToPredicate( theShape );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::HasName(const string & theName)
|
||||
{
|
||||
return new NamePredicate( theName );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasDim
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::HasDim(const int theDim)
|
||||
{
|
||||
return new DimPredicate( EQUAL, theDim );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsApplicableTo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::IsApplicableTo(const TopoDS_Shape& theShape)
|
||||
{
|
||||
return new ApplicablePredicate( theShape );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : HasType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoPredicate* SMESH_HypoFilter::HasType(const int theHypType)
|
||||
{
|
||||
return new TypePredicate( EQUAL, theHypType );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsOk
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESH_HypoFilter::IsOk (const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const
|
||||
{
|
||||
if ( myPredicates.empty() )
|
||||
return true;
|
||||
|
||||
bool ok = ( myPredicates.front()->_logical_op <= AND_NOT );
|
||||
list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
|
||||
for ( ; pred != myPredicates.end(); ++pred )
|
||||
{
|
||||
bool ok2 = (*pred)->IsOk( aHyp, aShape );
|
||||
switch ( (*pred)->_logical_op ) {
|
||||
case AND: ok = ok && ok2; break;
|
||||
case AND_NOT: ok = ok && !ok2; break;
|
||||
case OR: ok = ok || ok2; break;
|
||||
case OR_NOT: ok = ok || !ok2; break;
|
||||
default:;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter & SMESH_HypoFilter::Init ( SMESH_HypoPredicate* aPredicate, bool notNagate )
|
||||
{
|
||||
list<SMESH_HypoPredicate*>::const_iterator pred = myPredicates.begin();
|
||||
for ( ; pred != myPredicates.end(); ++pred )
|
||||
delete *pred;
|
||||
|
||||
add( notNagate ? AND : AND_NOT, aPredicate );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : IsOk
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_HypoFilter::~SMESH_HypoFilter()
|
||||
{
|
||||
Init(0);
|
||||
}
|
||||
|
164
src/SMESH/SMESH_HypoFilter.hxx
Normal file
164
src/SMESH/SMESH_HypoFilter.hxx
Normal file
@ -0,0 +1,164 @@
|
||||
// SMESH SMESH : implementaion of SMESH idl descriptions
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_HypoFilter.hxx
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
|
||||
#ifndef SMESH_HypoFilter_HeaderFile
|
||||
#define SMESH_HypoFilter_HeaderFile
|
||||
|
||||
// ===========================
|
||||
// Filter of SMESH_Hypothesis
|
||||
// ===========================
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
class SMESH_HypoFilter;
|
||||
class SMESH_Hypothesis;
|
||||
|
||||
class SMESH_HypoPredicate {
|
||||
public:
|
||||
virtual bool IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const = 0;
|
||||
// check aHyp or/and aShape it is assigned to
|
||||
virtual ~SMESH_HypoPredicate() {}
|
||||
private:
|
||||
int _logical_op;
|
||||
friend class SMESH_HypoFilter;
|
||||
};
|
||||
|
||||
class SMESH_HypoFilter: public SMESH_HypoPredicate
|
||||
{
|
||||
public:
|
||||
// Create and add predicates.
|
||||
// Added predicates will be destroyed by filter when it dies
|
||||
SMESH_HypoFilter();
|
||||
SMESH_HypoFilter( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
|
||||
// notNagate==false means !aPredicate->IsOk()
|
||||
SMESH_HypoFilter & Init ( SMESH_HypoPredicate* aPredicate, bool notNagate = true );
|
||||
SMESH_HypoFilter & And ( SMESH_HypoPredicate* aPredicate );
|
||||
SMESH_HypoFilter & AndNot( SMESH_HypoPredicate* aPredicate );
|
||||
SMESH_HypoFilter & Or ( SMESH_HypoPredicate* aPredicate );
|
||||
SMESH_HypoFilter & OrNot ( SMESH_HypoPredicate* aPredicate );
|
||||
|
||||
// Create predicates
|
||||
static SMESH_HypoPredicate* IsAlgo();
|
||||
static SMESH_HypoPredicate* IsApplicableTo(const TopoDS_Shape& theShape);
|
||||
static SMESH_HypoPredicate* IsAssignedTo(const TopoDS_Shape& theShape);
|
||||
static SMESH_HypoPredicate* Is(const SMESH_Hypothesis* theHypo);
|
||||
static SMESH_HypoPredicate* IsGlobal(const TopoDS_Shape& theMainShape);
|
||||
static SMESH_HypoPredicate* HasName(const std::string & theName);
|
||||
static SMESH_HypoPredicate* HasDim(const int theDim);
|
||||
static SMESH_HypoPredicate* HasType(const int theHypType);
|
||||
|
||||
bool IsOk (const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const;
|
||||
// check aHyp or/and aShape it is assigned to
|
||||
|
||||
~SMESH_HypoFilter();
|
||||
|
||||
|
||||
protected:
|
||||
// fields
|
||||
|
||||
std::list<SMESH_HypoPredicate*> myPredicates;
|
||||
|
||||
// private methods
|
||||
|
||||
enum Logical { AND, AND_NOT, OR, OR_NOT };
|
||||
enum Comparison { EQUAL, NOT_EQUAL, MORE, LESS };
|
||||
|
||||
SMESH_HypoFilter(const SMESH_HypoFilter& other){}
|
||||
|
||||
void add( Logical bool_op, SMESH_HypoPredicate* pred )
|
||||
{
|
||||
if ( pred ) {
|
||||
pred->_logical_op = bool_op;
|
||||
myPredicates.push_back( pred );
|
||||
}
|
||||
}
|
||||
|
||||
// predicates implementation
|
||||
|
||||
template <typename TValue>
|
||||
struct templPredicate: public SMESH_HypoPredicate {
|
||||
Comparison _comp;
|
||||
TValue _val;
|
||||
virtual TValue Value(const SMESH_Hypothesis* aHyp) const = 0;
|
||||
virtual bool IsOk(const SMESH_Hypothesis* aHyp, const TopoDS_Shape& ) const
|
||||
{
|
||||
if ( _comp == EQUAL ) return _val == Value( aHyp );
|
||||
else if ( _comp == NOT_EQUAL ) return _val != Value( aHyp );
|
||||
else if ( _comp == MORE ) return _val < Value( aHyp );
|
||||
else return _val > Value( aHyp );
|
||||
}
|
||||
};
|
||||
|
||||
struct NamePredicate : public SMESH_HypoPredicate {
|
||||
std::string _name;
|
||||
NamePredicate( std::string name ): _name(name){}
|
||||
bool IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const;
|
||||
};
|
||||
|
||||
struct TypePredicate : public templPredicate< int > {
|
||||
TypePredicate( Comparison comp, int hypType )
|
||||
{ _comp = comp; _val = hypType; }
|
||||
int Value( const SMESH_Hypothesis* aHyp ) const;
|
||||
};
|
||||
|
||||
struct DimPredicate : public templPredicate< int > {
|
||||
DimPredicate( Comparison comp, int dim )
|
||||
{ _comp = comp; _val = dim; }
|
||||
int Value( const SMESH_Hypothesis* aHyp ) const;
|
||||
};
|
||||
|
||||
struct ApplicablePredicate : public SMESH_HypoPredicate {
|
||||
int _shapeType;
|
||||
ApplicablePredicate( const TopoDS_Shape& theShape );
|
||||
bool IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const;
|
||||
};
|
||||
|
||||
struct InstancePredicate : public SMESH_HypoPredicate {
|
||||
const SMESH_Hypothesis* _hypo;
|
||||
InstancePredicate( const SMESH_Hypothesis* hypo ):_hypo(hypo){}
|
||||
bool IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const;
|
||||
};
|
||||
|
||||
struct IsAssignedToPredicate : public SMESH_HypoPredicate {
|
||||
TopoDS_Shape _mainShape;
|
||||
IsAssignedToPredicate( const TopoDS_Shape& mainShape ):_mainShape(mainShape){}
|
||||
bool IsOk(const SMESH_Hypothesis* aHyp,
|
||||
const TopoDS_Shape& aShape) const;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
1065
src/SMESHDS/SMESHDS_Mesh.cxx
Normal file
1065
src/SMESHDS/SMESHDS_Mesh.cxx
Normal file
File diff suppressed because it is too large
Load Diff
299
src/SMESHDS/SMESHDS_SubMesh.cxx
Normal file
299
src/SMESHDS/SMESHDS_SubMesh.cxx
Normal file
@ -0,0 +1,299 @@
|
||||
// SMESH SMESHDS : management of mesh data and SMESH document
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_SubMesh.cxx
|
||||
// Author : Yves FRICAUD, OCC
|
||||
// Module : SMESH
|
||||
// $Header:
|
||||
|
||||
#include "SMESHDS_SubMesh.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
//=======================================================================
|
||||
//function : AddElement
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
|
||||
{
|
||||
if ( !IsComplexSubmesh() )
|
||||
myElements.insert(ME);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveElement
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME)
|
||||
{
|
||||
if ( !IsComplexSubmesh() && NbElements() )
|
||||
return myElements.erase(ME);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddNode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
|
||||
{
|
||||
if ( !IsComplexSubmesh() )
|
||||
myNodes.insert(N);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveNode
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N)
|
||||
{
|
||||
if ( !IsComplexSubmesh() && NbNodes() )
|
||||
return myNodes.erase(N);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbElements
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMESHDS_SubMesh::NbElements() const
|
||||
{
|
||||
if ( !IsComplexSubmesh() )
|
||||
return myElements.size();
|
||||
|
||||
int nbElems = 0;
|
||||
#ifndef WNT
|
||||
set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
|
||||
#else
|
||||
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
||||
#endif
|
||||
for ( ; it != mySubMeshes.end(); it++ )
|
||||
nbElems += (*it)->NbElements();
|
||||
|
||||
return nbElems;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NbNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMESHDS_SubMesh::NbNodes() const
|
||||
{
|
||||
if ( !IsComplexSubmesh() )
|
||||
return myNodes.size();
|
||||
|
||||
int nbElems = 0;
|
||||
#ifndef WNT
|
||||
set<const SMESHDS_SubMesh*>::iterator it = mySubMeshes.begin();
|
||||
#else
|
||||
set<const SMESHDS_SubMesh*>::const_iterator it = mySubMeshes.begin();
|
||||
#endif
|
||||
for ( ; it != mySubMeshes.end(); it++ )
|
||||
nbElems += (*it)->NbNodes();
|
||||
|
||||
return nbElems;
|
||||
}
|
||||
|
||||
// =====================
|
||||
// class MySetIterator
|
||||
// =====================
|
||||
|
||||
template<typename T> class MySetIterator:public SMDS_Iterator<const T*>
|
||||
{
|
||||
typedef const set<const T*> TSet;
|
||||
typename TSet::const_iterator myIt;
|
||||
TSet& mySet;
|
||||
|
||||
public:
|
||||
MySetIterator(const set<const T*>& s):mySet(s), myIt(s.begin())
|
||||
{
|
||||
}
|
||||
|
||||
bool more()
|
||||
{
|
||||
return myIt!=mySet.end();
|
||||
}
|
||||
const T* next()
|
||||
{
|
||||
const T* t=*myIt;
|
||||
myIt++;
|
||||
return t;
|
||||
}
|
||||
};
|
||||
|
||||
// =====================
|
||||
// class MyIterator
|
||||
// =====================
|
||||
|
||||
template<typename VALUE> class MyIterator : public SMDS_Iterator<VALUE>
|
||||
{
|
||||
public:
|
||||
MyIterator (const set<const SMESHDS_SubMesh*>& theSubMeshes)
|
||||
: mySubMeshes( theSubMeshes ), mySubIt( theSubMeshes.begin() ), myMore(false)
|
||||
{}
|
||||
bool more()
|
||||
{
|
||||
while (( !myElemIt.get() || !myElemIt->more() ) &&
|
||||
mySubIt != mySubMeshes.end())
|
||||
{
|
||||
myElemIt = getElements(*mySubIt);
|
||||
mySubIt++;
|
||||
}
|
||||
myMore = myElemIt.get() && myElemIt->more();
|
||||
return myMore;
|
||||
}
|
||||
VALUE next()
|
||||
{
|
||||
VALUE elem = 0;
|
||||
if ( myMore )
|
||||
elem = myElemIt->next();
|
||||
return elem;
|
||||
}
|
||||
protected:
|
||||
virtual boost::shared_ptr< SMDS_Iterator<VALUE> >
|
||||
getElements(const SMESHDS_SubMesh*) const = 0;
|
||||
|
||||
private:
|
||||
bool myMore;
|
||||
const set<const SMESHDS_SubMesh*>& mySubMeshes;
|
||||
set<const SMESHDS_SubMesh*>::const_iterator mySubIt;
|
||||
boost::shared_ptr< SMDS_Iterator<VALUE> > myElemIt;
|
||||
};
|
||||
|
||||
// =====================
|
||||
// class MyElemIterator
|
||||
// =====================
|
||||
|
||||
class MyElemIterator: public MyIterator<const SMDS_MeshElement*>
|
||||
{
|
||||
public:
|
||||
MyElemIterator (const set<const SMESHDS_SubMesh*>& theSubMeshes)
|
||||
:MyIterator<const SMDS_MeshElement*>( theSubMeshes ) {}
|
||||
SMDS_ElemIteratorPtr getElements(const SMESHDS_SubMesh* theSubMesh) const
|
||||
{ return theSubMesh->GetElements(); }
|
||||
};
|
||||
|
||||
// =====================
|
||||
// class MyNodeIterator
|
||||
// =====================
|
||||
|
||||
class MyNodeIterator: public MyIterator<const SMDS_MeshNode*>
|
||||
{
|
||||
public:
|
||||
MyNodeIterator (const set<const SMESHDS_SubMesh*>& theSubMeshes)
|
||||
:MyIterator<const SMDS_MeshNode*>( theSubMeshes ) {}
|
||||
SMDS_NodeIteratorPtr getElements(const SMESHDS_SubMesh* theSubMesh) const
|
||||
{ return theSubMesh->GetNodes(); }
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : GetElements
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMDS_ElemIteratorPtr SMESHDS_SubMesh::GetElements() const
|
||||
{
|
||||
if ( IsComplexSubmesh() )
|
||||
return SMDS_ElemIteratorPtr( new MyElemIterator( mySubMeshes ));
|
||||
|
||||
return SMDS_ElemIteratorPtr(new MySetIterator<SMDS_MeshElement>(myElements));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes() const
|
||||
{
|
||||
if ( IsComplexSubmesh() )
|
||||
return SMDS_NodeIteratorPtr( new MyNodeIterator( mySubMeshes ));
|
||||
|
||||
return SMDS_NodeIteratorPtr(new MySetIterator<SMDS_MeshNode>(myNodes));
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Contains
|
||||
//purpose : check if elem or node is in
|
||||
//=======================================================================
|
||||
|
||||
bool SMESHDS_SubMesh::Contains(const SMDS_MeshElement * ME) const
|
||||
{
|
||||
// DO NOT TRY TO FIND A REMOVED ELEMENT !!
|
||||
if ( !ME )
|
||||
return false;
|
||||
|
||||
if ( IsComplexSubmesh() )
|
||||
{
|
||||
set<const SMESHDS_SubMesh*>::const_iterator aSubIt = mySubMeshes.begin();
|
||||
for ( ; aSubIt != mySubMeshes.end(); aSubIt++ )
|
||||
if ( (*aSubIt)->Contains( ME ))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( ME->GetType() == SMDSAbs_Node )
|
||||
{
|
||||
const SMDS_MeshNode* n = static_cast<const SMDS_MeshNode*>( ME );
|
||||
return ( myNodes.find( n ) != myNodes.end() );
|
||||
}
|
||||
|
||||
return ( myElements.find( ME ) != myElements.end() );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : AddSubMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMESHDS_SubMesh::AddSubMesh( const SMESHDS_SubMesh* theSubMesh )
|
||||
{
|
||||
ASSERT( theSubMesh );
|
||||
mySubMeshes.insert( theSubMesh );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : RemoveSubMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESHDS_SubMesh::RemoveSubMesh( const SMESHDS_SubMesh* theSubMesh )
|
||||
{
|
||||
return mySubMeshes.erase( theSubMesh );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ContainsSubMesh
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESHDS_SubMesh::ContainsSubMesh( const SMESHDS_SubMesh* theSubMesh ) const
|
||||
{
|
||||
return mySubMeshes.find( theSubMesh ) != mySubMeshes.end();
|
||||
}
|
69
src/SMESHDS/SMESHDS_SubMesh.hxx
Normal file
69
src/SMESHDS/SMESHDS_SubMesh.hxx
Normal file
@ -0,0 +1,69 @@
|
||||
// SMESH SMESHDS : management of mesh data and SMESH document
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHDS_SubMesh.hxx
|
||||
// Module : SMESH
|
||||
|
||||
#ifndef _SMESHDS_SubMesh_HeaderFile
|
||||
#define _SMESHDS_SubMesh_HeaderFile
|
||||
|
||||
#include "SMDS_Mesh.hxx"
|
||||
#include <set>
|
||||
|
||||
#if defined WNT && defined WIN32 && defined SMESHDS_EXPORTS
|
||||
#define SMESHDS_WNT_EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define SMESHDS_WNT_EXPORT
|
||||
#endif
|
||||
|
||||
class SMESHDS_WNT_EXPORT SMESHDS_SubMesh
|
||||
{
|
||||
public:
|
||||
|
||||
bool IsComplexSubmesh() const { return !mySubMeshes.empty(); }
|
||||
|
||||
// if !IsComplexSubmesh()
|
||||
void AddElement(const SMDS_MeshElement * ME);
|
||||
bool RemoveElement(const SMDS_MeshElement * ME); // ret true if ME was in
|
||||
void AddNode(const SMDS_MeshNode * ME);
|
||||
bool RemoveNode(const SMDS_MeshNode * ME); // ret true if ME was in
|
||||
|
||||
// if IsComplexSubmesh()
|
||||
void AddSubMesh( const SMESHDS_SubMesh* theSubMesh );
|
||||
bool RemoveSubMesh( const SMESHDS_SubMesh* theSubMesh );
|
||||
bool ContainsSubMesh( const SMESHDS_SubMesh* theSubMesh ) const;
|
||||
|
||||
// for both types
|
||||
int NbElements() const;
|
||||
SMDS_ElemIteratorPtr GetElements() const;
|
||||
int NbNodes() const;
|
||||
SMDS_NodeIteratorPtr GetNodes() const;
|
||||
bool Contains(const SMDS_MeshElement * ME) const; // check if elem or node is in
|
||||
|
||||
private:
|
||||
//const SMDS_Mesh * myMesh;
|
||||
std::set<const SMDS_MeshElement*> myElements;
|
||||
std::set<const SMDS_MeshNode*> myNodes;
|
||||
std::set<const SMESHDS_SubMesh*> mySubMeshes;
|
||||
};
|
||||
#endif
|
3059
src/SMESHGUI/SMESHGUI.cxx
Normal file
3059
src/SMESHGUI/SMESHGUI.cxx
Normal file
File diff suppressed because it is too large
Load Diff
963
src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx
Normal file
963
src/SMESHGUI/SMESHGUI_EditHypothesesDlg.cxx
Normal file
@ -0,0 +1,963 @@
|
||||
// SMESH SMESHGUI : GUI for SMESH component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESHGUI_EditHypothesesDlg.cxx
|
||||
// Author : Nicolas REJNERI
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#include "SMESHGUI_EditHypothesesDlg.h"
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
#include "SMESHGUI_HypothesesUtils.h"
|
||||
|
||||
#include "SMESH_TypeFilter.hxx"
|
||||
#include "SMESH_NumberFilter.hxx"
|
||||
|
||||
#include "SALOME_ListIO.hxx"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
|
||||
#include "SALOMEDSClient_Study.hxx"
|
||||
#include "SALOMEDSClient_AttributeIOR.hxx"
|
||||
#include "SALOMEDSClient_AttributeName.hxx"
|
||||
|
||||
#include "SUIT_Session.h"
|
||||
#include "SUIT_OverrideCursor.h"
|
||||
#include "SUIT_Operation.h"
|
||||
#include "SUIT_Desktop.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include "SVTK_ViewModel.h"
|
||||
|
||||
// QT Includes
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
//VRV: porting on Qt 3.0.5
|
||||
#if QT_VERSION >= 0x030005
|
||||
#include <qlistbox.h>
|
||||
#endif
|
||||
//VRV: porting on Qt 3.0.5
|
||||
|
||||
class ListBoxIOR : public QListBoxText
|
||||
{
|
||||
public:
|
||||
enum { RTTI_IOR = 1000 };
|
||||
|
||||
public:
|
||||
ListBoxIOR (QListBox* listbox,
|
||||
const char* ior,
|
||||
const QString& text = QString::null)
|
||||
: QListBoxText(listbox, text), myIOR(ior) {}
|
||||
virtual ~ListBoxIOR() {};
|
||||
virtual int rtti() const { return RTTI_IOR; }
|
||||
const char* GetIOR() { return myIOR.c_str(); }
|
||||
|
||||
private:
|
||||
string myIOR;
|
||||
};
|
||||
|
||||
#define ALLOW_CHANGE_SHAPE 0
|
||||
|
||||
int findItem (QListBox* listBox, const string& ior)
|
||||
{
|
||||
for (int i = 0; i < listBox->count(); i++) {
|
||||
if (listBox->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
|
||||
ListBoxIOR* anItem = (ListBoxIOR*)(listBox->item(i));
|
||||
if (anItem && ior == string(anItem->GetIOR()))
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SMESHGUI_EditHypothesesDlg()
|
||||
// purpose : Constructs a SMESHGUI_EditHypothesesDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
SMESHGUI_EditHypothesesDlg::SMESHGUI_EditHypothesesDlg (SMESHGUI* theModule, const char* name,
|
||||
bool modal, WFlags fl)
|
||||
: QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
|
||||
WStyle_Title | WStyle_SysMenu | WDestructiveClose),
|
||||
myImportedMesh(false),
|
||||
mySMESHGUI( theModule ),
|
||||
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
|
||||
{
|
||||
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
|
||||
if (!name)
|
||||
setName("SMESHGUI_EditHypothesesDlg");
|
||||
setCaption(tr("SMESH_EDIT_HYPOTHESES"));
|
||||
setSizeGripEnabled(TRUE);
|
||||
QGridLayout* SMESHGUI_EditHypothesesDlgLayout = new QGridLayout(this);
|
||||
SMESHGUI_EditHypothesesDlgLayout->setSpacing(6);
|
||||
SMESHGUI_EditHypothesesDlgLayout->setMargin(11);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox(tr("SMESH_ARGUMENTS"), this, "GroupC1");
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical);
|
||||
GroupC1->layout()->setSpacing(0);
|
||||
GroupC1->layout()->setMargin(0);
|
||||
QGridLayout* GroupC1Layout = new QGridLayout(GroupC1->layout());
|
||||
GroupC1Layout->setAlignment(Qt::AlignTop);
|
||||
GroupC1Layout->setSpacing(6);
|
||||
GroupC1Layout->setMargin(11);
|
||||
|
||||
TextLabelC1A1 = new QLabel(tr("SMESH_OBJECT_MESHorSUBMESH"), GroupC1, "TextLabelC1A1");
|
||||
GroupC1Layout->addWidget(TextLabelC1A1, 0, 0);
|
||||
SelectButtonC1A1 = new QPushButton(GroupC1, "SelectButtonC1A1");
|
||||
SelectButtonC1A1->setPixmap(image0);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
|
||||
LineEditC1A1 = new QLineEdit(GroupC1, "LineEditC1A1");
|
||||
LineEditC1A1->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A1, 0, 2);
|
||||
|
||||
TextLabelC1A2 = new QLabel(tr("SMESH_OBJECT_GEOM"), GroupC1, "TextLabelC1A2");
|
||||
GroupC1Layout->addWidget(TextLabelC1A2, 1, 0);
|
||||
SelectButtonC1A2 = new QPushButton(GroupC1, "SelectButtonC1A2");
|
||||
SelectButtonC1A2->setPixmap(image0);
|
||||
SelectButtonC1A2->setToggleButton(FALSE);
|
||||
GroupC1Layout->addWidget(SelectButtonC1A2, 1, 1);
|
||||
LineEditC1A2 = new QLineEdit(GroupC1, "LineEditC1A2");
|
||||
LineEditC1A2->setReadOnly(true);
|
||||
GroupC1Layout->addWidget(LineEditC1A2, 1, 2);
|
||||
|
||||
SMESHGUI_EditHypothesesDlgLayout->addWidget(GroupC1, 0, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupHypotheses = new QGroupBox(tr("SMESH_HYPOTHESES"), this, "GroupHypotheses");
|
||||
GroupHypotheses->setColumnLayout(0, Qt::Vertical);
|
||||
GroupHypotheses->layout()->setSpacing(0);
|
||||
GroupHypotheses->layout()->setMargin(0);
|
||||
QGridLayout* grid_3 = new QGridLayout(GroupHypotheses->layout());
|
||||
grid_3->setAlignment(Qt::AlignTop);
|
||||
grid_3->setSpacing(6);
|
||||
grid_3->setMargin(11);
|
||||
|
||||
TextHypDefinition = new QLabel(tr("SMESH_AVAILABLE"), GroupHypotheses, "TextHypDefinition");
|
||||
grid_3->addWidget(TextHypDefinition, 0, 0);
|
||||
|
||||
ListHypDefinition = new QListBox(GroupHypotheses, "ListHypDefinition");
|
||||
ListHypDefinition->setMinimumSize(100, 100);
|
||||
grid_3->addWidget(ListHypDefinition, 1, 0);
|
||||
|
||||
TextHypAssignation = new QLabel(tr("SMESH_EDIT_USED"), GroupHypotheses, "TextHypAssignation");
|
||||
grid_3->addWidget(TextHypAssignation, 0, 1);
|
||||
|
||||
ListHypAssignation = new QListBox(GroupHypotheses, "ListHypAssignation");
|
||||
ListHypAssignation->setMinimumSize(100, 100);
|
||||
grid_3->addWidget(ListHypAssignation, 1, 1);
|
||||
|
||||
SMESHGUI_EditHypothesesDlgLayout->addWidget(GroupHypotheses, 1, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupAlgorithms = new QGroupBox(tr("SMESH_ADD_ALGORITHM"), this, "GroupAlgorithms");
|
||||
GroupAlgorithms->setColumnLayout(0, Qt::Vertical);
|
||||
GroupAlgorithms->layout()->setSpacing(0);
|
||||
GroupAlgorithms->layout()->setMargin(0);
|
||||
QGridLayout* grid_4 = new QGridLayout(GroupAlgorithms->layout());
|
||||
grid_4->setAlignment(Qt::AlignTop);
|
||||
grid_4->setSpacing(6);
|
||||
grid_4->setMargin(11);
|
||||
|
||||
TextAlgoDefinition = new QLabel(tr("SMESH_AVAILABLE"), GroupAlgorithms, "TextAlgoDefinition");
|
||||
grid_4->addWidget(TextAlgoDefinition, 0, 0);
|
||||
|
||||
ListAlgoDefinition = new QListBox(GroupAlgorithms, "ListAlgoDefinition");
|
||||
ListAlgoDefinition->setMinimumSize(100, 100);
|
||||
grid_4->addWidget(ListAlgoDefinition, 1, 0);
|
||||
|
||||
TextAlgoAssignation = new QLabel(tr("SMESH_EDIT_USED"), GroupAlgorithms, "TextAlgoAssignation");
|
||||
grid_4->addWidget(TextAlgoAssignation, 0, 1);
|
||||
|
||||
ListAlgoAssignation = new QListBox(GroupAlgorithms, "ListAlgoAssignation");
|
||||
ListAlgoAssignation ->setMinimumSize(100, 100);
|
||||
grid_4->addWidget(ListAlgoAssignation, 1, 1);
|
||||
|
||||
SMESHGUI_EditHypothesesDlgLayout->addWidget(GroupAlgorithms, 2, 0);
|
||||
|
||||
/***************************************************************/
|
||||
GroupButtons = new QGroupBox(this, "GroupButtons");
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical);
|
||||
GroupButtons->layout()->setSpacing(0);
|
||||
GroupButtons->layout()->setMargin(0);
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout(GroupButtons->layout());
|
||||
GroupButtonsLayout->setAlignment(Qt::AlignTop);
|
||||
GroupButtonsLayout->setSpacing(6);
|
||||
GroupButtonsLayout->setMargin(11);
|
||||
|
||||
buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons, "buttonOk");
|
||||
buttonOk->setAutoDefault(TRUE);
|
||||
buttonOk->setDefault(FALSE);
|
||||
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
|
||||
|
||||
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons, "buttonApply");
|
||||
buttonApply->setAutoDefault(TRUE);
|
||||
buttonApply->setDefault(FALSE);
|
||||
GroupButtonsLayout->addWidget(buttonApply, 0, 1);
|
||||
|
||||
GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2);
|
||||
|
||||
buttonCancel = new QPushButton(tr("SMESH_BUT_CLOSE"), GroupButtons, "buttonCancel");
|
||||
buttonCancel->setAutoDefault(TRUE);
|
||||
buttonCancel->setDefault(TRUE);
|
||||
buttonCancel->setEnabled(TRUE);
|
||||
GroupButtonsLayout->addWidget(buttonCancel, 0, 3);
|
||||
|
||||
SMESHGUI_EditHypothesesDlgLayout->addWidget(GroupButtons, 4, 0);
|
||||
|
||||
/***************************************************************/
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ~SMESHGUI_EditHypothesesDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
SMESHGUI_EditHypothesesDlg::~SMESHGUI_EditHypothesesDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::Init()
|
||||
{
|
||||
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
|
||||
|
||||
InitHypDefinition();
|
||||
InitAlgoDefinition();
|
||||
|
||||
//myGeomFilter = new SALOME_TypeFilter ("GEOM");
|
||||
TColStd_MapOfInteger allTypesMap;
|
||||
for (int i = 0; i < 10; i++)
|
||||
allTypesMap.Add(i);
|
||||
myGeomFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, 0, allTypesMap);
|
||||
myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
|
||||
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
mySubMesh = SMESH::SMESH_subMesh::_nil();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
connect(SelectButtonC1A1, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectButtonC1A2, SIGNAL (clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
|
||||
|
||||
connect(ListHypAssignation, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(removeItem(QListBoxItem*)));
|
||||
connect(ListAlgoAssignation, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(removeItem(QListBoxItem*)));
|
||||
|
||||
connect(ListHypDefinition, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(addItem(QListBoxItem*)));
|
||||
connect(ListAlgoDefinition, SIGNAL(doubleClicked(QListBoxItem*)), this, SLOT(addItem(QListBoxItem*)));
|
||||
|
||||
int x, y;
|
||||
mySMESHGUI->DefineDlgPosition(this, x, y);
|
||||
this->move(x, y);
|
||||
this->show();
|
||||
|
||||
LineEditC1A1->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
|
||||
|
||||
SelectionIntoArgument();
|
||||
|
||||
UpdateControlState();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::ClickOnOk()
|
||||
{
|
||||
if (ClickOnApply())
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_EditHypothesesDlg::ClickOnApply()
|
||||
{
|
||||
if (mySMESHGUI->isActiveStudyLocked())
|
||||
return false;
|
||||
|
||||
bool aRes = false;
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
SUIT_Operation* op = new SUIT_Operation
|
||||
(SUIT_Session::session()->activeApplication());
|
||||
|
||||
// start transaction
|
||||
op->start();
|
||||
|
||||
if (!myMesh->_is_nil())
|
||||
aRes = StoreMesh();
|
||||
else if (!mySubMesh->_is_nil())
|
||||
aRes = StoreSubMesh();
|
||||
|
||||
if (true/*aRes*/) { // abort desynchronizes contents of a Study and a mesh on server
|
||||
// commit transaction
|
||||
op->commit();
|
||||
InitHypAssignation();
|
||||
InitAlgoAssignation();
|
||||
} else {
|
||||
// abort transaction
|
||||
op->abort();
|
||||
}
|
||||
|
||||
UpdateControlState();
|
||||
mySMESHGUI->updateObjBrowser();
|
||||
|
||||
return aRes;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::ClickOnCancel()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SelectionIntoArgument()
|
||||
// purpose : Called when selection as changed or other case
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::SelectionIntoArgument()
|
||||
{
|
||||
QString aString = "";
|
||||
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
|
||||
|
||||
int nbSel = SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
|
||||
|
||||
if (myEditCurrentArgument == LineEditC1A1) {
|
||||
if (nbSel != 1) {
|
||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||
mySubMesh = SMESH::SMESH_subMesh::_nil();
|
||||
aString = "";
|
||||
} else {
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
|
||||
if (myMesh->_is_nil()) {
|
||||
mySubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
|
||||
if (mySubMesh->_is_nil()) {
|
||||
aString = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
myEditCurrentArgument->setText(aString);
|
||||
|
||||
// InitGeom() will try to retrieve a shape from myMesh or mySubMesh
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
InitGeom();
|
||||
|
||||
myImportedMesh = myGeomShape->_is_nil();
|
||||
|
||||
InitHypAssignation();
|
||||
InitAlgoAssignation();
|
||||
|
||||
} else if (myEditCurrentArgument == LineEditC1A2) {
|
||||
if (nbSel != 1) {
|
||||
myGeomShape = GEOM::GEOM_Object::_nil();
|
||||
} else {
|
||||
Handle(SALOME_InteractiveObject) IO = aList.First();
|
||||
myGeomShape = SMESH::IObjectToInterface<GEOM::GEOM_Object>(IO);
|
||||
}
|
||||
InitGeom();
|
||||
}
|
||||
|
||||
UpdateControlState();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myMeshOrSubMeshFilter);
|
||||
} else if (send == SelectButtonC1A2) {
|
||||
LineEditC1A2->setFocus();
|
||||
myEditCurrentArgument = LineEditC1A2;
|
||||
mySelectionMgr->clearFilters();
|
||||
mySelectionMgr->installFilter(myGeomFilter);
|
||||
}
|
||||
SelectionIntoArgument();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if (GroupC1->isEnabled()) {
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
GroupC1->setEnabled(false);
|
||||
GroupButtons->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::ActivateThisDialog()
|
||||
{
|
||||
mySMESHGUI->EmitSignalDeactivateDialog();
|
||||
GroupC1->setEnabled(true);
|
||||
GroupButtons->setEnabled(true);
|
||||
connect (mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::enterEvent (QEvent*)
|
||||
{
|
||||
if (!GroupC1->isEnabled())
|
||||
ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::closeEvent (QCloseEvent* e)
|
||||
{
|
||||
disconnect(mySelectionMgr, 0, this, 0);
|
||||
mySMESHGUI->ResetState();
|
||||
mySelectionMgr->clearFilters();
|
||||
QDialog::closeEvent(e);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : IsOld()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool SMESHGUI_EditHypothesesDlg::IsOld (QListBoxItem* hypItem)
|
||||
{
|
||||
if (hypItem->rtti() == ListBoxIOR::RTTI_IOR) {
|
||||
ListBoxIOR* hyp = (ListBoxIOR*) hypItem;
|
||||
return (myMapOldHypos.find(hyp->GetIOR()) != myMapOldHypos.end() ||
|
||||
myMapOldAlgos.find(hyp->GetIOR()) != myMapOldAlgos.end());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : removeItem()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::removeItem (QListBoxItem* item)
|
||||
{
|
||||
const QObject* aSender = sender();
|
||||
|
||||
if (!item) return;
|
||||
|
||||
if (aSender == ListHypAssignation) {
|
||||
myNbModification += IsOld(item) ? 1 : -1;
|
||||
ListHypAssignation->removeItem(ListHypAssignation->index(item));
|
||||
}
|
||||
else if (aSender == ListAlgoAssignation) {
|
||||
myNbModification += IsOld(item) ? 1 : -1;
|
||||
ListAlgoAssignation->removeItem(ListAlgoAssignation->index(item));
|
||||
}
|
||||
|
||||
UpdateControlState();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : addItem()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::addItem (QListBoxItem* item)
|
||||
{
|
||||
const QObject* aSender = sender();
|
||||
|
||||
if (!item) return;
|
||||
|
||||
ListBoxIOR* i = 0;
|
||||
if (item->rtti() == ListBoxIOR::RTTI_IOR)
|
||||
i = (ListBoxIOR*)item;
|
||||
if (!i) return;
|
||||
|
||||
bool isFound = false;
|
||||
|
||||
ListBoxIOR* anItem;
|
||||
if (aSender == ListHypDefinition) {
|
||||
for (int j = 0, n = ListHypAssignation->count(); !isFound && j < n; j++) {
|
||||
if (ListHypAssignation->item(j)->rtti() == ListBoxIOR::RTTI_IOR) {
|
||||
anItem = (ListBoxIOR*)ListHypAssignation->item(j);
|
||||
isFound = !strcmp(anItem->GetIOR(), i->GetIOR());
|
||||
}
|
||||
}
|
||||
if (!isFound)
|
||||
anItem = new ListBoxIOR (ListHypAssignation,
|
||||
CORBA::string_dup(i->GetIOR()),
|
||||
CORBA::string_dup(i->text().latin1()));
|
||||
|
||||
} else if (aSender == ListAlgoDefinition) {
|
||||
for (int j = 0, n = ListAlgoAssignation->count(); !isFound && j < n; j++) {
|
||||
if (ListAlgoAssignation->item(j)->rtti() == ListBoxIOR::RTTI_IOR) {
|
||||
anItem = (ListBoxIOR*)ListAlgoAssignation->item(j);
|
||||
isFound = !strcmp(anItem->GetIOR(), i->GetIOR());
|
||||
}
|
||||
}
|
||||
if (!isFound)
|
||||
anItem = new ListBoxIOR (ListAlgoAssignation,
|
||||
CORBA::string_dup(i->GetIOR()),
|
||||
CORBA::string_dup(i->text().latin1()));
|
||||
} else {
|
||||
}
|
||||
|
||||
if (!isFound)
|
||||
myNbModification += IsOld(item) ? -1 : 1;
|
||||
|
||||
UpdateControlState();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : InitHypDefinition()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::InitHypDefinition()
|
||||
{
|
||||
ListHypDefinition->clear();
|
||||
|
||||
_PTR(SComponent) father = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
|
||||
if (!father)
|
||||
return;
|
||||
|
||||
_PTR(SObject) HypothesisRoot;
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
_PTR(AttributeName) aName;
|
||||
_PTR(AttributeIOR) anIOR;
|
||||
|
||||
//int Tag_HypothesisRoot = 1;
|
||||
if (father->FindSubObject(1, HypothesisRoot)) {
|
||||
_PTR(ChildIterator) it =
|
||||
SMESH::GetActiveStudyDocument()->NewChildIterator(HypothesisRoot);
|
||||
ListBoxIOR* anItem;
|
||||
for (; it->More();it->Next()) {
|
||||
_PTR(SObject) Obj = it->Value();
|
||||
if (Obj->FindAttribute(anAttr, "AttributeName")) {
|
||||
aName = anAttr;
|
||||
if (Obj->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
anIOR = anAttr;
|
||||
anItem = new ListBoxIOR (ListHypDefinition,
|
||||
anIOR->Value().c_str(),
|
||||
aName->Value().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : InitHypAssignation()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::InitHypAssignation()
|
||||
{
|
||||
myNbModification = 0;
|
||||
|
||||
myMapOldHypos.clear();
|
||||
ListHypAssignation->clear();
|
||||
if (myImportedMesh)
|
||||
return;
|
||||
|
||||
_PTR(SObject) aMorSM, AHR, aRef;
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
_PTR(AttributeName) aName;
|
||||
_PTR(AttributeIOR) anIOR;
|
||||
|
||||
if (!myMesh->_is_nil())
|
||||
aMorSM = SMESH::FindSObject(myMesh);
|
||||
else if (!mySubMesh->_is_nil())
|
||||
aMorSM = SMESH::FindSObject(mySubMesh);
|
||||
|
||||
if (aMorSM && aMorSM->FindSubObject(2, AHR)) {
|
||||
_PTR(ChildIterator) it =
|
||||
SMESH::GetActiveStudyDocument()->NewChildIterator(AHR);
|
||||
for (; it->More();it->Next()) {
|
||||
_PTR(SObject) Obj = it->Value();
|
||||
if (Obj->ReferencedObject(aRef)) {
|
||||
if (aRef->FindAttribute(anAttr, "AttributeName")) {
|
||||
aName = anAttr;
|
||||
if (aRef->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
anIOR = anAttr;
|
||||
ListBoxIOR* anItem = new ListBoxIOR (ListHypAssignation,
|
||||
anIOR->Value().c_str(),
|
||||
aName->Value().c_str());
|
||||
myMapOldHypos[ anIOR->Value() ] = ListHypAssignation->index(anItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : InitAlgoDefinition()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::InitAlgoDefinition()
|
||||
{
|
||||
ListAlgoDefinition->clear();
|
||||
|
||||
_PTR(SComponent) father = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
|
||||
if (!father)
|
||||
return;
|
||||
|
||||
_PTR(SObject) AlgorithmsRoot;
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
_PTR(AttributeName) aName;
|
||||
_PTR(AttributeIOR) anIOR;
|
||||
|
||||
if (father->FindSubObject (2, AlgorithmsRoot)) {
|
||||
_PTR(ChildIterator) it =
|
||||
SMESH::GetActiveStudyDocument()->NewChildIterator(AlgorithmsRoot);
|
||||
ListBoxIOR* anItem;
|
||||
for (; it->More();it->Next()) {
|
||||
_PTR(SObject) Obj = it->Value();
|
||||
if (Obj->FindAttribute(anAttr, "AttributeName")) {
|
||||
aName = anAttr;
|
||||
if (Obj->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
anIOR = anAttr;
|
||||
anItem = new ListBoxIOR (ListAlgoDefinition,
|
||||
anIOR->Value().c_str(),
|
||||
aName->Value().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : InitAlgoAssignation()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::InitAlgoAssignation()
|
||||
{
|
||||
myMapOldAlgos.clear();
|
||||
ListAlgoAssignation->clear();
|
||||
if (myImportedMesh)
|
||||
return;
|
||||
|
||||
_PTR(SObject) aMorSM, AHR, aRef;
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
_PTR(AttributeName) aName;
|
||||
_PTR(AttributeIOR) anIOR;
|
||||
|
||||
if (!myMesh->_is_nil())
|
||||
aMorSM = SMESH::FindSObject(myMesh);
|
||||
else if (!mySubMesh->_is_nil())
|
||||
aMorSM = SMESH::FindSObject(mySubMesh);
|
||||
|
||||
if (aMorSM && aMorSM->FindSubObject(3, AHR)) {
|
||||
_PTR(ChildIterator) it =
|
||||
SMESH::GetActiveStudyDocument()->NewChildIterator(AHR);
|
||||
for (; it->More();it->Next()) {
|
||||
_PTR(SObject) Obj = it->Value();
|
||||
if (Obj->ReferencedObject(aRef)) {
|
||||
if (aRef->FindAttribute(anAttr, "AttributeName")) {
|
||||
aName = anAttr;
|
||||
if (aRef->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
anIOR = anAttr;
|
||||
ListBoxIOR* anItem = new ListBoxIOR (ListAlgoAssignation,
|
||||
anIOR->Value().c_str(),
|
||||
aName->Value().c_str());
|
||||
myMapOldAlgos[ anIOR->Value() ] = ListAlgoAssignation->index(anItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : InitGeom()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::InitGeom()
|
||||
{
|
||||
LineEditC1A2->setText("");
|
||||
|
||||
if (myGeomShape->_is_nil() && !myMesh->_is_nil()) {
|
||||
_PTR(SObject) aMesh = SMESH::FindSObject(myMesh);
|
||||
if (aMesh)
|
||||
myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMesh);
|
||||
}
|
||||
if (myGeomShape->_is_nil() && !mySubMesh->_is_nil()) {
|
||||
_PTR(SObject) aSubMesh = SMESH::FindSObject(mySubMesh);
|
||||
if (aSubMesh)
|
||||
myGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aSubMesh);
|
||||
}
|
||||
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
_PTR(AttributeName) aName;
|
||||
if (!myGeomShape->_is_nil() && (!myMesh->_is_nil() || !mySubMesh->_is_nil())) {
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
//_PTR(SObject) aSO = aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(myGeomShape));
|
||||
_PTR(SObject) aSO = aStudy->FindObjectID(myGeomShape->GetStudyEntry());
|
||||
if (aSO) {
|
||||
if (aSO->FindAttribute(anAttr, "AttributeName")) {
|
||||
aName = anAttr;
|
||||
LineEditC1A2->setText(QString(aName->Value().c_str()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : UpdateControlState()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void SMESHGUI_EditHypothesesDlg::UpdateControlState()
|
||||
{
|
||||
// asl the check of "count" is commented because of PAL9787
|
||||
bool isEnabled = (!myMesh->_is_nil() && !myGeomShape->_is_nil() /*&&
|
||||
ListHypAssignation->count() && ListAlgoAssignation->count()*/ )
|
||||
||
|
||||
(!mySubMesh->_is_nil() && !myGeomShape->_is_nil() /*&&
|
||||
(ListHypAssignation->count() || ListAlgoAssignation->count())*/);
|
||||
|
||||
buttonOk ->setEnabled(myNbModification && isEnabled && !myImportedMesh);
|
||||
buttonApply->setEnabled(myNbModification && isEnabled && !myImportedMesh);
|
||||
|
||||
SelectButtonC1A2 ->setEnabled(ALLOW_CHANGE_SHAPE && !myImportedMesh);
|
||||
LineEditC1A2 ->setEnabled(ALLOW_CHANGE_SHAPE && !myImportedMesh);
|
||||
ListHypDefinition ->setEnabled(!myImportedMesh);
|
||||
ListHypAssignation ->setEnabled(!myImportedMesh);
|
||||
ListAlgoDefinition ->setEnabled(!myImportedMesh);
|
||||
ListAlgoAssignation->setEnabled(!myImportedMesh);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : StoreMesh()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_EditHypothesesDlg::StoreMesh()
|
||||
{
|
||||
MapIOR anOldHypos, aNewHypos;
|
||||
if (myGeomShape->_is_nil())
|
||||
return false;
|
||||
|
||||
// 1. Check whether the geometric shape has changed
|
||||
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
|
||||
GEOM::GEOM_Object_var aIniGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aMeshSO);
|
||||
bool bShapeChanged = aIniGeomShape->_is_nil() ||
|
||||
!aIniGeomShape->_is_equivalent(myGeomShape);
|
||||
if (bShapeChanged) {
|
||||
// VSR : TODO : Set new shape - not supported yet by SMESH engine
|
||||
// 1. remove all old hypotheses and algorithms and also submeshes
|
||||
// 2. set new shape
|
||||
}
|
||||
|
||||
int nbFail = 0;
|
||||
MapIOR::iterator it;
|
||||
|
||||
// 2. remove not used hypotheses from the mesh
|
||||
for (it = myMapOldHypos.begin(); it != myMapOldHypos.end(); ++it) {
|
||||
string ior = it->first;
|
||||
int index = findItem(ListHypAssignation, ior);
|
||||
if (index < 0) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp =
|
||||
SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
|
||||
if (!aHyp->_is_nil()) {
|
||||
if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh(aMeshSO, aHyp))
|
||||
nbFail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. remove not used algorithms from the mesh
|
||||
for (it = myMapOldAlgos.begin(); it != myMapOldAlgos.end(); ++it) {
|
||||
string ior = it->first;
|
||||
int index = findItem(ListAlgoAssignation, ior);
|
||||
if (index < 0) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp =
|
||||
SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
|
||||
if (!aHyp->_is_nil()) {
|
||||
if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh(aMeshSO, aHyp))
|
||||
nbFail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Add new algorithms
|
||||
for (int i = 0; i < ListAlgoAssignation->count(); i++) {
|
||||
if (ListAlgoAssignation->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
|
||||
ListBoxIOR* anItem = (ListBoxIOR*)(ListAlgoAssignation->item(i));
|
||||
if (anItem) {
|
||||
string ior = anItem->GetIOR();
|
||||
if (myMapOldAlgos.find(ior) == myMapOldAlgos.end()) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp =
|
||||
SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
|
||||
if (!aHyp->_is_nil()) {
|
||||
if (!SMESH::AddHypothesisOnMesh(myMesh, aHyp))
|
||||
nbFail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Add new hypotheses
|
||||
for (int i = 0; i < ListHypAssignation->count(); i++) {
|
||||
if (ListHypAssignation->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
|
||||
ListBoxIOR* anItem = (ListBoxIOR*)(ListHypAssignation->item(i));
|
||||
if (anItem) {
|
||||
string ior = anItem->GetIOR();
|
||||
if (myMapOldHypos.find(ior) == myMapOldHypos.end()) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp =
|
||||
SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
|
||||
if (!aHyp->_is_nil()) {
|
||||
if (!SMESH::AddHypothesisOnMesh(myMesh, aHyp))
|
||||
nbFail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (nbFail == 0);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : StoreSubMesh()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
bool SMESHGUI_EditHypothesesDlg::StoreSubMesh()
|
||||
{
|
||||
MapIOR anOldHypos, aNewHypos;
|
||||
if (myGeomShape->_is_nil())
|
||||
return false;
|
||||
|
||||
// 1. Check whether the geometric shape has changed
|
||||
_PTR(SObject) aSubMeshSO = SMESH::FindSObject(mySubMesh);
|
||||
GEOM::GEOM_Object_var aIniGeomShape = SMESH::GetShapeOnMeshOrSubMesh(aSubMeshSO);
|
||||
bool bShapeChanged = aIniGeomShape->_is_nil() || !aIniGeomShape->_is_equivalent(myGeomShape);
|
||||
if (bShapeChanged) {
|
||||
// VSR : TODO : Set new shape - not supported yet by engine
|
||||
// 1. remove all old hypotheses and algorithms
|
||||
// 2. set new shape
|
||||
}
|
||||
int nbFail = 0;
|
||||
MapIOR::iterator it;
|
||||
|
||||
// 2. remove not used hypotheses from the submesh
|
||||
for (it = myMapOldHypos.begin(); it != myMapOldHypos.end(); ++it) {
|
||||
string ior = it->first;
|
||||
int index = findItem(ListHypAssignation, ior);
|
||||
if (index < 0) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
|
||||
if (!aHyp->_is_nil()) {
|
||||
if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh(aSubMeshSO, aHyp))
|
||||
nbFail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3. remove not used algorithms from the submesh
|
||||
for (it = myMapOldAlgos.begin(); it != myMapOldAlgos.end(); ++it) {
|
||||
string ior = it->first;
|
||||
int index = findItem(ListAlgoAssignation, ior);
|
||||
if (index < 0) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
|
||||
if (!aHyp->_is_nil()){
|
||||
if (!SMESH::RemoveHypothesisOrAlgorithmOnMesh(aSubMeshSO, aHyp))
|
||||
nbFail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. Add new algorithms
|
||||
for (int i = 0; i < ListAlgoAssignation->count(); i++) {
|
||||
if (ListAlgoAssignation->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
|
||||
ListBoxIOR* anItem = (ListBoxIOR*)(ListAlgoAssignation->item(i));
|
||||
if (anItem) {
|
||||
string ior = anItem->GetIOR();
|
||||
if (myMapOldAlgos.find(ior) == myMapOldAlgos.end()) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
|
||||
if (!aHyp->_is_nil()){
|
||||
if (!SMESH::AddHypothesisOnSubMesh(mySubMesh, aHyp))
|
||||
nbFail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Add new hypotheses
|
||||
for (int i = 0; i < ListHypAssignation->count(); i++) {
|
||||
if (ListHypAssignation->item(i)->rtti() == ListBoxIOR::RTTI_IOR) {
|
||||
ListBoxIOR* anItem = (ListBoxIOR*)(ListHypAssignation->item(i));
|
||||
if (anItem) {
|
||||
string ior = anItem->GetIOR();
|
||||
if (myMapOldHypos.find(ior) == myMapOldHypos.end()) {
|
||||
SMESH::SMESH_Hypothesis_var aHyp = SMESH::IORToInterface<SMESH::SMESH_Hypothesis>(ior.c_str());
|
||||
if (!aHyp->_is_nil()){
|
||||
if (!SMESH::AddHypothesisOnSubMesh(mySubMesh, aHyp))
|
||||
nbFail++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return (nbFail == 0);
|
||||
}
|
1448
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
Normal file
1448
src/SMESHGUI/SMESHGUI_GroupDlg.cxx
Normal file
File diff suppressed because it is too large
Load Diff
1298
src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx
Executable file
1298
src/SMESHGUI/SMESHGUI_MultiEditDlg.cxx
Executable file
File diff suppressed because it is too large
Load Diff
433
src/SMESHGUI/SMESHGUI_Selection.cxx
Normal file
433
src/SMESHGUI/SMESHGUI_Selection.cxx
Normal file
@ -0,0 +1,433 @@
|
||||
|
||||
#include "SMESHGUI_Selection.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
#include "SMESHGUI_MeshUtils.h"
|
||||
#include "SMESHGUI_GEOMGenUtils.h"
|
||||
|
||||
#include "SMESH_Type.h"
|
||||
#include "SMESH_Actor.h"
|
||||
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
#include "SalomeApp_Study.h"
|
||||
#include "SalomeApp_VTKSelector.h"
|
||||
|
||||
#include "SUIT_Session.h"
|
||||
|
||||
#include "SVTK_RenderWindowInteractor.h"
|
||||
#include "SVTK_ViewWindow.h"
|
||||
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
|
||||
//=======================================================================
|
||||
//function : SMESHGUI_Selection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMESHGUI_Selection::SMESHGUI_Selection()
|
||||
: SalomeApp_Selection()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ~SMESHGUI_Selection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
SMESHGUI_Selection::~SMESHGUI_Selection()
|
||||
{
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void SMESHGUI_Selection::init( const QString& client, SalomeApp_SelectionMgr* mgr )
|
||||
{
|
||||
SalomeApp_Selection::init( client, mgr );
|
||||
|
||||
if( mgr && study() )
|
||||
{
|
||||
_PTR(Study) aStudy = study()->studyDS();
|
||||
|
||||
SUIT_DataOwnerPtrList sel;
|
||||
mgr->selected( sel, client );
|
||||
myDataOwners = sel;
|
||||
SUIT_DataOwnerPtrList::const_iterator anIt = sel.begin(),
|
||||
aLast = sel.end();
|
||||
for( ; anIt!=aLast; anIt++ )
|
||||
{
|
||||
SUIT_DataOwner* owner = ( SUIT_DataOwner* )( (*anIt ).get() );
|
||||
SalomeApp_DataOwner* sowner = dynamic_cast<SalomeApp_DataOwner*>( owner );
|
||||
if( sowner )
|
||||
myTypes.append( typeName( type( sowner, aStudy ) ) );
|
||||
else
|
||||
myTypes.append( "Unknown" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : param
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
QtxValue SMESHGUI_Selection::param( const int ind, const QString& p ) const
|
||||
{
|
||||
QtxValue val;
|
||||
if ( p=="client" ) val = QtxValue( globalParam( p ) );
|
||||
else if ( p=="type" ) val = QtxValue( myTypes[ind] );
|
||||
else if ( p=="elemTypes" ) val = QtxValue( elemTypes( ind ) );
|
||||
else if ( p=="numberOfNodes" ) val = QtxValue( numberOfNodes( ind ) );
|
||||
else if ( p=="labeledTypes" ) val = QtxValue( labeledTypes( ind ) );
|
||||
else if ( p=="shrinkMode" ) val = QtxValue( shrinkMode( ind ) );
|
||||
else if ( p=="entityMode" ) val = QtxValue( entityMode( ind ) );
|
||||
else if ( p=="controlMode" ) val = QtxValue( controlMode( ind ) );
|
||||
else if ( p=="displayMode" ) val = QtxValue( displayMode( ind ) );
|
||||
else if ( p=="isComputable" ) val = QtxValue( isComputable( ind ) );
|
||||
else if ( p=="hasReference" ) val = QtxValue( hasReference( ind ) );
|
||||
else if ( p=="isVisible" ) val = QtxValue( isVisible( ind ) );
|
||||
|
||||
// printf( "--> param() : [%s] = %s (%s)\n", p.latin1(), val.toString().latin1(), val.typeName() );
|
||||
//if ( val.type() == QVariant::List )
|
||||
//cout << "size: " << val.toList().count() << endl;
|
||||
return val;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getVtkOwner
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
SMESH_Actor* SMESHGUI_Selection::getActor( int ind ) const
|
||||
{
|
||||
if ( ind >= 0 && ind < myDataOwners.count() ) {
|
||||
const SalomeApp_SVTKDataOwner* owner =
|
||||
dynamic_cast<const SalomeApp_SVTKDataOwner*> ( myDataOwners[ ind ].get() );
|
||||
if ( owner )
|
||||
return dynamic_cast<SMESH_Actor*>( owner->GetActor() );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : elemTypes
|
||||
//purpose : may return {'Edge' 'Face' 'Volume'} at most
|
||||
//=======================================================================
|
||||
|
||||
QValueList<QVariant> SMESHGUI_Selection::elemTypes( int ind ) const
|
||||
{
|
||||
QValueList<QVariant> types;
|
||||
SMESH_Actor* actor = getActor( ind );
|
||||
if ( actor ) {
|
||||
TVisualObjPtr object = actor->GetObject();
|
||||
if ( object ) {
|
||||
if ( object->GetNbEntities( SMDSAbs_Edge )) types.append( "Edge" );
|
||||
if ( object->GetNbEntities( SMDSAbs_Face )) types.append( "Face" );
|
||||
if ( object->GetNbEntities( SMDSAbs_Volume )) types.append( "Volume" );
|
||||
}
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : labeledTypes
|
||||
//purpose : may return {'Point' 'Cell'} at most
|
||||
//=======================================================================
|
||||
|
||||
QValueList<QVariant> SMESHGUI_Selection::labeledTypes( int ind ) const
|
||||
{
|
||||
QValueList<QVariant> types;
|
||||
SMESH_Actor* actor = getActor( ind );
|
||||
if ( actor ) {
|
||||
if ( actor->GetPointsLabeled()) types.append( "Point" );
|
||||
if ( actor->GetCellsLabeled()) types.append( "Cell" );
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : displayMode
|
||||
//purpose : return SMESH_Actor::EReperesent
|
||||
//=======================================================================
|
||||
|
||||
QString SMESHGUI_Selection::displayMode( int ind ) const
|
||||
{
|
||||
SMESH_Actor* actor = getActor( ind );
|
||||
if ( actor ) {
|
||||
switch( actor->GetRepresentation() ) {
|
||||
case SMESH_Actor::eEdge: return "eEdge";
|
||||
case SMESH_Actor::eSurface: return "eSurface";
|
||||
case SMESH_Actor::ePoint: return "ePoint";
|
||||
default:;
|
||||
}
|
||||
}
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : shrinkMode
|
||||
//purpose : return either 'IsSrunk', 'IsNotShrunk' or 'IsNotShrinkable'
|
||||
//=======================================================================
|
||||
|
||||
QString SMESHGUI_Selection::shrinkMode( int ind ) const
|
||||
{
|
||||
SMESH_Actor* actor = getActor( ind );
|
||||
if ( actor && actor->IsShrunkable() ) {
|
||||
if ( actor->IsShrunk() )
|
||||
return "IsShrunk";
|
||||
return "IsNotShrunk";
|
||||
}
|
||||
return "IsNotShrinkable";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : entityMode
|
||||
//purpose : may return {'Edge' 'Face' 'Volume'} at most
|
||||
//=======================================================================
|
||||
|
||||
QValueList<QVariant> SMESHGUI_Selection::entityMode( int ind ) const
|
||||
{
|
||||
QValueList<QVariant> types;
|
||||
SMESH_Actor* actor = getActor( ind );
|
||||
if ( actor ) {
|
||||
unsigned int aMode = actor->GetEntityMode();
|
||||
if ( aMode & SMESH_Actor::eVolumes) types.append( "Volume");
|
||||
if ( aMode & SMESH_Actor::eFaces ) types.append( "Face" );
|
||||
if ( aMode & SMESH_Actor::eEdges ) types.append( "Edge" );
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : controlMode
|
||||
//purpose : return SMESH_Actor::eControl
|
||||
//=======================================================================
|
||||
|
||||
QString SMESHGUI_Selection::controlMode( int ind ) const
|
||||
{
|
||||
SMESH_Actor* actor = getActor( ind );
|
||||
if ( actor ) {
|
||||
switch( actor->GetControlMode() ) {
|
||||
case SMESH_Actor::eLength: return "eLength";
|
||||
case SMESH_Actor::eLength2D: return "eLength2D";
|
||||
case SMESH_Actor::eFreeEdges: return "eFreeEdges";
|
||||
case SMESH_Actor::eFreeBorders: return "eFreeBorders";
|
||||
case SMESH_Actor::eMultiConnection: return "eMultiConnection";
|
||||
case SMESH_Actor::eMultiConnection2D: return "eMultiConnection2D";
|
||||
case SMESH_Actor::eArea: return "eArea";
|
||||
case SMESH_Actor::eTaper: return "eTaper";
|
||||
case SMESH_Actor::eAspectRatio: return "eAspectRatio";
|
||||
case SMESH_Actor::eAspectRatio3D: return "eAspectRatio3D";
|
||||
case SMESH_Actor::eMinimumAngle: return "eMinimumAngle";
|
||||
case SMESH_Actor::eWarping: return "eWarping";
|
||||
case SMESH_Actor::eSkew: return "eSkew";
|
||||
default:;
|
||||
}
|
||||
}
|
||||
return "eNone";
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : numberOfNodes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMESHGUI_Selection::numberOfNodes( int ind ) const
|
||||
{
|
||||
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
|
||||
{
|
||||
CORBA::Object_var obj =
|
||||
SMESH::DataOwnerToObject( static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() ));
|
||||
if ( ! CORBA::is_nil( obj )) {
|
||||
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
|
||||
if ( ! mesh->_is_nil() )
|
||||
return mesh->NbNodes();
|
||||
SMESH::SMESH_subMesh_var aSubMeshObj = SMESH::SMESH_subMesh::_narrow( obj );
|
||||
if ( !aSubMeshObj->_is_nil() )
|
||||
return aSubMeshObj->GetNumberOfNodes(true);
|
||||
SMESH::SMESH_GroupBase_var aGroupObj = SMESH::SMESH_GroupBase::_narrow( obj );
|
||||
if ( !aGroupObj->_is_nil() )
|
||||
return aGroupObj->Size();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isComputable
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
QVariant SMESHGUI_Selection::isComputable( int ind ) const
|
||||
{
|
||||
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) io =
|
||||
static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->IO();
|
||||
if ( !io.IsNull() ) {
|
||||
SMESH::SMESH_Mesh_var mesh = SMESH::GetMeshByIO(io) ; // m,sm,gr->m
|
||||
if ( !mesh->_is_nil() ) {
|
||||
_PTR(SObject) so = SMESH::FindSObject( mesh );
|
||||
if ( so ) {
|
||||
GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
|
||||
return QVariant( !shape->_is_nil(), 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return QVariant( false, 0 );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : hasReference
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
QVariant SMESHGUI_Selection::hasReference( int ind ) const
|
||||
{
|
||||
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
|
||||
{
|
||||
SalomeApp_DataOwner* owner = dynamic_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].operator->() );
|
||||
if( owner )
|
||||
{
|
||||
_PTR(SObject) obj ( study()->studyDS()->FindObjectID( owner->entry().latin1() ) ), ref;
|
||||
return QVariant( obj->ReferencedObject( ref ), 0 );
|
||||
}
|
||||
}
|
||||
return QVariant( false, 0 );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isVisible
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
QVariant SMESHGUI_Selection::isVisible( int ind ) const
|
||||
{
|
||||
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
|
||||
{
|
||||
QString entry = static_cast<SalomeApp_DataOwner*>( myDataOwners[ ind ].get() )->entry();
|
||||
SMESH_Actor* actor = SMESH::FindActorByEntry( entry.latin1() );
|
||||
if ( actor && actor->hasIO() ) {
|
||||
SVTK_RenderWindowInteractor* renderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
|
||||
return QVariant( renderInter->isVisible( actor->getIO() ), 0 );
|
||||
}
|
||||
}
|
||||
return QVariant( false, 0 );
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int SMESHGUI_Selection::type( SalomeApp_DataOwner* owner, _PTR(Study) study )
|
||||
{
|
||||
return type( owner->entry(), study );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : type
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMESHGUI_Selection::type( const QString& entry, _PTR(Study) study )
|
||||
{
|
||||
_PTR(SObject) obj (study->FindObjectID(entry.latin1()));
|
||||
if( !obj )
|
||||
return -1;
|
||||
|
||||
_PTR(SObject) ref;
|
||||
if( obj->ReferencedObject( ref ) )
|
||||
obj = ref;
|
||||
|
||||
_PTR(SObject) objFather = obj->GetFather();
|
||||
_PTR(SComponent) objComponent = obj->GetFatherComponent();
|
||||
|
||||
if( objComponent->ComponentDataType()!="SMESH" )
|
||||
return -1;
|
||||
|
||||
int aLevel = obj->Depth() - objComponent->Depth(),
|
||||
aFTag = objFather->Tag(),
|
||||
anOTag = obj->Tag(),
|
||||
res = -1;
|
||||
|
||||
switch( aLevel )
|
||||
{
|
||||
case 1:
|
||||
if( anOTag>=3 )
|
||||
res = MESH;
|
||||
break;
|
||||
case 2:
|
||||
switch( aFTag )
|
||||
{
|
||||
case 1:
|
||||
res = HYPOTHESIS;
|
||||
break;
|
||||
case 2:
|
||||
res = ALGORITHM;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch( aFTag )
|
||||
{
|
||||
case 4:
|
||||
res = SUBMESH_VERTEX;
|
||||
break;
|
||||
case 5:
|
||||
res = SUBMESH_EDGE;
|
||||
break;
|
||||
case 7:
|
||||
res = SUBMESH_FACE;
|
||||
break;
|
||||
case 9:
|
||||
res = SUBMESH_SOLID;
|
||||
break;
|
||||
case 10:
|
||||
res = SUBMESH_COMPOUND;
|
||||
break;
|
||||
}
|
||||
if( aFTag>10 )
|
||||
res = GROUP;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : typeName
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
QString SMESHGUI_Selection::typeName( const int t )
|
||||
{
|
||||
switch( t )
|
||||
{
|
||||
case HYPOTHESIS:
|
||||
return "Hypothesis";
|
||||
case ALGORITHM:
|
||||
return "Algorithm";
|
||||
case MESH:
|
||||
return "Mesh";
|
||||
case SUBMESH:
|
||||
return "SubMesh";
|
||||
case MESHorSUBMESH:
|
||||
return "Mesh or submesh";
|
||||
case SUBMESH_VERTEX:
|
||||
return "Mesh vertex";
|
||||
case SUBMESH_EDGE:
|
||||
return "Mesh edge";
|
||||
case SUBMESH_FACE:
|
||||
return "Mesh face";
|
||||
case SUBMESH_SOLID:
|
||||
return "Mesh solid";
|
||||
case SUBMESH_COMPOUND:
|
||||
return "Mesh compound";
|
||||
case GROUP:
|
||||
return "Group";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
779
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
Normal file
779
src/SMESHGUI/SMESHGUI_VTKUtils.cxx
Normal file
@ -0,0 +1,779 @@
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
|
||||
|
||||
#include "SMESHGUI_VTKUtils.h"
|
||||
#include "SMESHGUI_Utils.h"
|
||||
#include "SMESHGUI_Filter.h"
|
||||
|
||||
#include <vtkRenderer.h>
|
||||
#include <vtkActorCollection.h>
|
||||
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
#include <SUIT_Desktop.h>
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_Study.h>
|
||||
|
||||
#include "SalomeApp_SelectionMgr.h"
|
||||
|
||||
#include "SVTK_Selector.h"
|
||||
#include "SVTK_ViewModel.h"
|
||||
#include "SVTK_ViewWindow.h"
|
||||
#include "SVTK_RenderWindow.h"
|
||||
#include "SVTK_InteractorStyle.h"
|
||||
#include "SVTK_RenderWindowInteractor.h"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include "SALOMEconfig.h"
|
||||
#include CORBA_CLIENT_HEADER(SMESH_Gen)
|
||||
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
|
||||
#include CORBA_CLIENT_HEADER(SMESH_Group)
|
||||
#include CORBA_CLIENT_HEADER(SMESH_Hypothesis)
|
||||
|
||||
#include "SMESHGUI.h"
|
||||
#include "SMESH_Actor.h"
|
||||
#include "SMESH_ObjectDef.h"
|
||||
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <SalomeApp_SelectionMgr.h>
|
||||
#include <SalomeApp_Study.h>
|
||||
|
||||
#include <SALOMEDSClient_Study.hxx>
|
||||
#include <SALOMEDSClient_SObject.hxx>
|
||||
|
||||
#include <SALOME_ListIO.hxx>
|
||||
#include <SALOME_ListIteratorOfListIO.hxx>
|
||||
|
||||
#include <set>
|
||||
using namespace std;
|
||||
|
||||
namespace SMESH{
|
||||
|
||||
typedef map<TKeyOfVisualObj,TVisualObjPtr> TVisualObjCont;
|
||||
static TVisualObjCont VISUAL_OBJ_CONT;
|
||||
|
||||
TVisualObjPtr GetVisualObj(int theStudyId, const char* theEntry){
|
||||
TVisualObjPtr aVisualObj;
|
||||
try{
|
||||
TVisualObjCont::key_type aKey(theStudyId,theEntry);
|
||||
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.find(aKey);
|
||||
if(anIter != VISUAL_OBJ_CONT.end()){
|
||||
aVisualObj = anIter->second;
|
||||
}else{
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SMESHGUI::activeStudy()->application() );
|
||||
_PTR(Study) aStudy = SMESHGUI::activeStudy()->studyDS();
|
||||
_PTR(SObject) aSObj = aStudy->FindObjectID(theEntry);
|
||||
if(aSObj){
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
if(aSObj->FindAttribute(anAttr,"AttributeIOR")){
|
||||
_PTR(AttributeIOR) anIOR = anAttr;
|
||||
CORBA::String_var aVal = anIOR->Value().c_str();
|
||||
CORBA::Object_var anObj = app->orb()->string_to_object( aVal.in() );
|
||||
if(!CORBA::is_nil(anObj)){
|
||||
//Try narrow to SMESH_Mesh interafce
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
|
||||
if(!aMesh->_is_nil()){
|
||||
aVisualObj.reset(new SMESH_MeshObj(aMesh));
|
||||
aVisualObj->Update();
|
||||
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
||||
VISUAL_OBJ_CONT.insert(aValue);
|
||||
return aVisualObj;
|
||||
}
|
||||
//Try narrow to SMESH_Group interafce
|
||||
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
|
||||
if(!aGroup->_is_nil()){
|
||||
_PTR(SObject) aFatherSObj = aSObj->GetFather();
|
||||
if(!aFatherSObj) return aVisualObj;
|
||||
aFatherSObj = aFatherSObj->GetFather();
|
||||
if(!aFatherSObj) return aVisualObj;
|
||||
CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
|
||||
TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
|
||||
if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
|
||||
aVisualObj.reset(new SMESH_GroupObj(aGroup,aMeshObj));
|
||||
aVisualObj->Update();
|
||||
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
||||
VISUAL_OBJ_CONT.insert(aValue);
|
||||
return aVisualObj;
|
||||
}
|
||||
}
|
||||
//Try narrow to SMESH_subMesh interafce
|
||||
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
|
||||
if(!aSubMesh->_is_nil()){
|
||||
_PTR(SObject) aFatherSObj = aSObj->GetFather();
|
||||
if(!aFatherSObj) return aVisualObj;
|
||||
aFatherSObj = aFatherSObj->GetFather();
|
||||
if(!aFatherSObj) return aVisualObj;
|
||||
CORBA::String_var anEntry = aFatherSObj->GetID().c_str();
|
||||
TVisualObjPtr aVisObj = GetVisualObj(theStudyId,anEntry.in());
|
||||
if(SMESH_MeshObj* aMeshObj = dynamic_cast<SMESH_MeshObj*>(aVisObj.get())){
|
||||
aVisualObj.reset(new SMESH_subMeshObj(aSubMesh,aMeshObj));
|
||||
aVisualObj->Update();
|
||||
TVisualObjCont::value_type aValue(aKey,aVisualObj);
|
||||
VISUAL_OBJ_CONT.insert(aValue);
|
||||
return aVisualObj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(...){
|
||||
INFOS("GetMeshObj - There is no SMESH_Mesh object for the SALOMEDS::Strudy and Entry!!!");
|
||||
}
|
||||
return aVisualObj;
|
||||
}
|
||||
|
||||
|
||||
SVTK_ViewWindow*
|
||||
GetViewWindow(const SalomeApp_Module* theModule)
|
||||
{
|
||||
if (SalomeApp_Application* anApp = theModule->getApp())
|
||||
return dynamic_cast<SVTK_ViewWindow*>(anApp->desktop()->activeWindow());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SVTK_ViewWindow* FindVtkViewWindow( SUIT_ViewManager* theMgr,
|
||||
SUIT_ViewWindow* theWindow )
|
||||
{
|
||||
if( !theMgr )
|
||||
return NULL;
|
||||
|
||||
QPtrVector<SUIT_ViewWindow> views = theMgr->getViews();
|
||||
if( views.containsRef( theWindow ) )
|
||||
return GetVtkViewWindow( theWindow );
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SVTK_ViewWindow* GetVtkViewWindow(SUIT_ViewWindow* theWindow){
|
||||
return dynamic_cast<SVTK_ViewWindow*>(theWindow);
|
||||
}
|
||||
|
||||
|
||||
/* SUIT_ViewWindow* GetActiveWindow()
|
||||
{
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
|
||||
if( !app )
|
||||
return NULL;
|
||||
SUIT_ViewManager* mgr = app->activeViewManager();
|
||||
if( mgr )
|
||||
return mgr->getActiveView();
|
||||
else
|
||||
return NULL;
|
||||
}*/
|
||||
|
||||
SVTK_ViewWindow* GetCurrentVtkView(){
|
||||
return GetVtkViewWindow( GetActiveWindow() );
|
||||
}
|
||||
|
||||
void RepaintViewWindow(SVTK_ViewWindow* theWindow)
|
||||
{
|
||||
theWindow->Repaint();
|
||||
}
|
||||
|
||||
void RenderViewWindow(SVTK_ViewWindow* theWindow)
|
||||
{
|
||||
theWindow->getRenderer()->Render();
|
||||
theWindow->Repaint();
|
||||
}
|
||||
|
||||
SMESH_Actor* FindActorByEntry(SUIT_ViewWindow *theWindow,
|
||||
const char* theEntry)
|
||||
{
|
||||
if(SVTK_ViewWindow* aViewWindow = GetVtkViewWindow(theWindow)){
|
||||
vtkRenderer *aRenderer = aViewWindow->getRenderer();
|
||||
vtkActorCollection *aCollection = aRenderer->GetActors();
|
||||
aCollection->InitTraversal();
|
||||
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
|
||||
if(anActor->hasIO()){
|
||||
Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
|
||||
if(anIO->hasEntry() && strcmp(anIO->getEntry(),theEntry) == 0){
|
||||
return anActor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SMESH_Actor* FindActorByEntry(const char* theEntry){
|
||||
return FindActorByEntry(GetActiveWindow(),theEntry);
|
||||
}
|
||||
|
||||
|
||||
SMESH_Actor* FindActorByObject(CORBA::Object_ptr theObject){
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
|
||||
if( !app )
|
||||
return NULL;
|
||||
|
||||
if(!CORBA::is_nil(theObject)){
|
||||
_PTR(Study) aStudy = GetActiveStudyDocument();
|
||||
CORBA::String_var anIOR = app->orb()->object_to_string( theObject );
|
||||
_PTR(SObject) aSObject = aStudy->FindObjectIOR(anIOR.in());
|
||||
if(aSObject){
|
||||
CORBA::String_var anEntry = aSObject->GetID().c_str();
|
||||
return FindActorByEntry(anEntry.in());
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
SMESH_Actor* CreateActor(_PTR(Study) theStudy,
|
||||
const char* theEntry,
|
||||
int theIsClear)
|
||||
{
|
||||
SMESH_Actor *anActor = NULL;
|
||||
CORBA::Long anId = theStudy->StudyId();
|
||||
if(TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry)){
|
||||
_PTR(SObject) aSObj = theStudy->FindObjectID(theEntry);
|
||||
if(aSObj){
|
||||
_PTR(GenericAttribute) anAttr;
|
||||
if(aSObj->FindAttribute(anAttr,"AttributeName")){
|
||||
_PTR(AttributeName) aName = anAttr;
|
||||
std::string aNameVal = aName->Value();
|
||||
anActor = SMESH_Actor::New(aVisualObj,theEntry,aNameVal.c_str(),theIsClear);
|
||||
}
|
||||
}
|
||||
}
|
||||
return anActor;
|
||||
}
|
||||
|
||||
|
||||
void DisplayActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
|
||||
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
|
||||
vtkWnd->AddActor(theActor);
|
||||
vtkWnd->Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RemoveActor( SUIT_ViewWindow *theWnd, SMESH_Actor* theActor){
|
||||
if(SVTK_ViewWindow* vtkWnd = GetVtkViewWindow(theWnd)){
|
||||
vtkWnd->RemoveActor(theActor);
|
||||
if(theActor->hasIO()){
|
||||
Handle(SALOME_InteractiveObject) anIO = theActor->getIO();
|
||||
if(anIO->hasEntry()){
|
||||
std::string anEntry = anIO->getEntry();
|
||||
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( vtkWnd->getViewManager()->study() );
|
||||
int aStudyId = aStudy->id();
|
||||
TVisualObjCont::key_type aKey(aStudyId,anEntry);
|
||||
VISUAL_OBJ_CONT.erase(aKey);
|
||||
}
|
||||
}
|
||||
theActor->Delete();
|
||||
vtkWnd->Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FitAll(){
|
||||
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() ){
|
||||
wnd->onFitAll();
|
||||
wnd->Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
vtkRenderer* GetCurrentRenderer(){
|
||||
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() )
|
||||
return wnd->getRenderer();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void RepaintCurrentView(){
|
||||
if(SVTK_ViewWindow* wnd = GetCurrentVtkView() )
|
||||
{
|
||||
wnd->getRenderer()->Render();
|
||||
wnd->Repaint(false);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
|
||||
{
|
||||
if(SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd)){
|
||||
vtkRenderer *aRenderer = aViewWnd->getRenderer();
|
||||
vtkActorCollection *aCollection = aRenderer->GetActors();
|
||||
aCollection->InitTraversal();
|
||||
switch(theAction){
|
||||
case eDisplayAll: {
|
||||
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
|
||||
anActor->SetVisibility(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case eDisplayOnly:
|
||||
case eEraseAll: {
|
||||
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
|
||||
anActor->SetVisibility(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
default: {
|
||||
if(SMESH_Actor *anActor = FindActorByEntry(theWnd,theEntry)){
|
||||
switch(theAction) {
|
||||
case eDisplay:
|
||||
case eDisplayOnly:
|
||||
anActor->SetVisibility(true);
|
||||
break;
|
||||
case eErase:
|
||||
anActor->SetVisibility(false);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(theAction){
|
||||
case eDisplay:
|
||||
case eDisplayOnly:{
|
||||
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( theWnd->getViewManager()->study() );
|
||||
_PTR(Study) aDocument = aStudy->studyDS();
|
||||
if((anActor = CreateActor(aDocument,theEntry,true))) {
|
||||
DisplayActor(theWnd,anActor);
|
||||
FitAll();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void UpdateView(EDisplaing theAction, const char* theEntry){
|
||||
SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() );
|
||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
|
||||
SUIT_ViewWindow *aWnd = app->activeViewManager()->getActiveView();
|
||||
UpdateView(aWnd,theAction,theEntry);
|
||||
}
|
||||
|
||||
void UpdateView(){
|
||||
if(SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()){
|
||||
SalomeApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
|
||||
SALOME_ListIO selected; mgr->selectedObjects( selected );
|
||||
|
||||
if( selected.Extent() == 0){
|
||||
vtkRenderer* aRenderer = aWnd->getRenderer();
|
||||
vtkActorCollection *aCollection = aRenderer->GetActors();
|
||||
aCollection->InitTraversal();
|
||||
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
|
||||
if(anActor->hasIO())
|
||||
Update(anActor->getIO(),anActor->GetVisibility());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
SALOME_ListIteratorOfListIO anIter( selected );
|
||||
for(; anIter.More(); anIter.Next()){
|
||||
Handle(SALOME_InteractiveObject) anIO = anIter.Value();
|
||||
Update(anIO,true);
|
||||
}
|
||||
}
|
||||
RepaintCurrentView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Update(const Handle(SALOME_InteractiveObject)& theIO,
|
||||
bool theDisplay)
|
||||
{
|
||||
_PTR(Study) aStudy = GetActiveStudyDocument();
|
||||
CORBA::Long anId = aStudy->StudyId();
|
||||
TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry());
|
||||
if( aVisualObj )
|
||||
aVisualObj->Update();
|
||||
if ( theDisplay )
|
||||
UpdateView(SMESH::eDisplay,theIO->getEntry());
|
||||
}
|
||||
|
||||
|
||||
void UpdateSelectionProp( SMESHGUI* theModule ) {
|
||||
if( !theModule )
|
||||
return;
|
||||
|
||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( theModule->application() );
|
||||
if( !app )
|
||||
{
|
||||
MESSAGE( "UpdateSelectionProp: Application is null" );
|
||||
return;
|
||||
}
|
||||
|
||||
SUIT_ViewManager* vm = app->activeViewManager();
|
||||
if( !vm )
|
||||
{
|
||||
MESSAGE( "UpdateSelectionProp: View manager is null" );
|
||||
return;
|
||||
}
|
||||
|
||||
QPtrVector<SUIT_ViewWindow> views = vm->getViews();
|
||||
|
||||
SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( theModule );
|
||||
if( !mgr )
|
||||
{
|
||||
MESSAGE( "UpdateSelectionProp: Resource manager is null" );
|
||||
return;
|
||||
}
|
||||
|
||||
QColor aHiColor = mgr->colorValue( "SMESH", "selection_object_color", Qt::white ),
|
||||
aSelColor = mgr->colorValue( "SMESH", "selection_element_color", Qt::yellow ),
|
||||
aPreColor = mgr->colorValue( "SMESH", "highlight_color", Qt::cyan );
|
||||
|
||||
int SW = mgr->integerValue( "SMESH", "selection_width", 5 ),
|
||||
PW = mgr->integerValue( "SMESH", "highlight_width", 5 );
|
||||
|
||||
double SP1 = mgr->doubleValue( "SMESH", "selection_precision_node", 0.025 ),
|
||||
SP2 = mgr->doubleValue( "SMESH", "selection_precision_element", 0.001 );
|
||||
|
||||
for ( int i=0, n=views.count(); i<n; i++ ) {
|
||||
SVTK_ViewWindow* aVtkView = GetVtkViewWindow( views[i] );
|
||||
if (!aVtkView) continue;
|
||||
// update VTK viewer properties
|
||||
SVTK_RenderWindowInteractor* anInteractor = aVtkView->getRWInteractor();
|
||||
if (anInteractor) {
|
||||
// mesh element selection
|
||||
anInteractor->SetSelectionProp(aSelColor.red()/255., aSelColor.green()/255.,
|
||||
aSelColor.blue()/255., SW );
|
||||
|
||||
// tolerances
|
||||
anInteractor->SetSelectionTolerance(SP1, SP2);
|
||||
|
||||
// pre-selection
|
||||
SVTK_InteractorStyle* aStyle =
|
||||
dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
|
||||
if (aStyle) {
|
||||
aStyle->setPreselectionProp(aPreColor.red()/255., aPreColor.green()/255.,
|
||||
aPreColor.blue()/255., PW);
|
||||
}
|
||||
}
|
||||
// update actors
|
||||
vtkRenderer* aRenderer = aVtkView->getRenderer();
|
||||
vtkActorCollection *aCollection = aRenderer->GetActors();
|
||||
aCollection->InitTraversal();
|
||||
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
|
||||
anActor->SetHighlightColor(aHiColor.red()/255., aHiColor.green()/255.,
|
||||
aHiColor.blue()/255.);
|
||||
anActor->SetPreHighlightColor(aPreColor.red()/255., aPreColor.green()/255.,
|
||||
aPreColor.blue()/255.);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
SVTK_InteractorStyle* GetInteractorStyle(SUIT_ViewWindow *theWindow){
|
||||
if(SVTK_ViewWindow* aWnd = GetVtkViewWindow(theWindow)){
|
||||
if(SVTK_RenderWindowInteractor* anInteractor = aWnd->getRWInteractor()){
|
||||
return dynamic_cast<SVTK_InteractorStyle*>( anInteractor->GetInteractorStyle() );
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SetFilter(const Handle(VTKViewer_Filter)& theFilter,
|
||||
SVTK_InteractorStyle* theStyle)
|
||||
{
|
||||
if (theStyle)
|
||||
theStyle->SetFilter(theFilter);
|
||||
}
|
||||
|
||||
Handle(VTKViewer_Filter) GetFilter(int theId, SVTK_InteractorStyle* theStyle)
|
||||
{
|
||||
return theStyle->GetFilter(theId);
|
||||
}
|
||||
|
||||
bool IsFilterPresent(int theId, SVTK_InteractorStyle* theStyle)
|
||||
{
|
||||
return theStyle->IsFilterPresent(theId);
|
||||
}
|
||||
|
||||
void RemoveFilter(int theId, SVTK_InteractorStyle* theStyle)
|
||||
{
|
||||
theStyle->RemoveFilter(theId);
|
||||
}
|
||||
|
||||
void RemoveFilters(SVTK_InteractorStyle* theStyle)
|
||||
{
|
||||
for ( int id = SMESHGUI_NodeFilter; theStyle && id < SMESHGUI_LastFilter; id++ )
|
||||
theStyle->RemoveFilter( id );
|
||||
}
|
||||
|
||||
bool IsValid(SALOME_Actor* theActor, int theCellId,
|
||||
SVTK_InteractorStyle* theStyle)
|
||||
{
|
||||
return theStyle->IsValid(theActor,theCellId);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void SetPointRepresentation(bool theIsVisible){
|
||||
if(SVTK_ViewWindow* aViewWindow = GetCurrentVtkView()){
|
||||
vtkRenderer *aRenderer = aViewWindow->getRenderer();
|
||||
vtkActorCollection *aCollection = aRenderer->GetActors();
|
||||
aCollection->InitTraversal();
|
||||
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){
|
||||
if(anActor->GetVisibility()){
|
||||
anActor->SetPointRepresentation(theIsVisible);
|
||||
}
|
||||
}
|
||||
}
|
||||
RepaintCurrentView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SetPickable(SMESH_Actor* theActor){
|
||||
if(SVTK_ViewWindow* aWnd = GetCurrentVtkView()){
|
||||
int anIsAllPickable = (theActor == NULL);
|
||||
vtkRenderer *aRenderer = aWnd->getRenderer();
|
||||
vtkActorCollection *aCollection = aRenderer->GetActors();
|
||||
aCollection->InitTraversal();
|
||||
while(vtkActor *anAct = aCollection->GetNextActor()){
|
||||
if(SALOME_Actor *anActor = dynamic_cast<SALOME_Actor*>(anAct)){
|
||||
if(anActor->GetVisibility()){
|
||||
anActor->SetPickable(anIsAllPickable);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(theActor)
|
||||
theActor->SetPickable(!anIsAllPickable);
|
||||
RepaintCurrentView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int GetNameOfSelectedNodes(SVTK_Selector* theSelector,
|
||||
const Handle(SALOME_InteractiveObject)& theIO,
|
||||
QString& theName)
|
||||
{
|
||||
theName = "";
|
||||
TColStd_IndexedMapOfInteger aMapIndex;
|
||||
theSelector->GetIndex(theIO,aMapIndex);
|
||||
|
||||
for(int i = 1; i <= aMapIndex.Extent(); i++)
|
||||
theName += QString(" %1").arg(aMapIndex(i));
|
||||
|
||||
return aMapIndex.Extent();
|
||||
}
|
||||
|
||||
int GetNameOfSelectedElements(SVTK_Selector* theSelector,
|
||||
const Handle(SALOME_InteractiveObject)& theIO,
|
||||
QString& theName)
|
||||
{
|
||||
theName = "";
|
||||
TColStd_IndexedMapOfInteger aMapIndex;
|
||||
theSelector->GetIndex(theIO,aMapIndex);
|
||||
|
||||
typedef std::set<int> TIdContainer;
|
||||
TIdContainer anIdContainer;
|
||||
for( int i = 1; i <= aMapIndex.Extent(); i++)
|
||||
anIdContainer.insert(aMapIndex(i));
|
||||
|
||||
TIdContainer::const_iterator anIter = anIdContainer.begin();
|
||||
for(; anIter != anIdContainer.end(); anIter++)
|
||||
theName += QString(" %1").arg(*anIter);
|
||||
|
||||
return aMapIndex.Extent();
|
||||
}
|
||||
|
||||
|
||||
int GetEdgeNodes(SVTK_Selector* theSelector,
|
||||
const TVisualObjPtr& theVisualObject,
|
||||
int& theId1,
|
||||
int& theId2)
|
||||
{
|
||||
const SALOME_ListIO& selected = theSelector->StoredIObjects();
|
||||
|
||||
if ( selected.Extent() != 1 )
|
||||
return -1;
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||
if ( anIO.IsNull() || !anIO->hasEntry() )
|
||||
return -1;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMapIndex;
|
||||
theSelector->GetIndex( anIO, aMapIndex );
|
||||
if ( aMapIndex.Extent() != 2 )
|
||||
return -1;
|
||||
|
||||
int anObjId = -1, anEdgeNum = -1;
|
||||
for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
|
||||
int aVal = aMapIndex( i );
|
||||
if ( aVal > 0 )
|
||||
anObjId = aVal;
|
||||
else
|
||||
anEdgeNum = abs( aVal ) - 1;
|
||||
}
|
||||
|
||||
if ( anObjId == -1 || anEdgeNum == -1 )
|
||||
return -1;
|
||||
|
||||
return theVisualObject->GetEdgeNodes( anObjId, anEdgeNum, theId1, theId2 ) ? 1 : -1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int GetNameOfSelectedNodes(SalomeApp_SelectionMgr *theMgr,
|
||||
const Handle(SALOME_InteractiveObject)& theIO,
|
||||
QString& theName)
|
||||
{
|
||||
theName = "";
|
||||
if(theIO->hasEntry()){
|
||||
if(FindActorByEntry(theIO->getEntry())){
|
||||
TColStd_IndexedMapOfInteger aMapIndex;
|
||||
theMgr->GetIndexes(theIO,aMapIndex);
|
||||
for(int i = 1; i <= aMapIndex.Extent(); i++){
|
||||
theName += QString(" %1").arg(aMapIndex(i));
|
||||
}
|
||||
return aMapIndex.Extent();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int GetNameOfSelectedNodes(SalomeApp_SelectionMgr *theMgr, QString& theName){
|
||||
theName = "";
|
||||
SALOME_ListIO selected; theMgr->selectedObjects( selected );
|
||||
if(selected.Extent() == 1){
|
||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||
return GetNameOfSelectedNodes(theMgr,anIO,theName);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int GetNameOfSelectedElements(SalomeApp_SelectionMgr *theMgr,
|
||||
const Handle(SALOME_InteractiveObject)& theIO,
|
||||
QString& theName)
|
||||
{
|
||||
theName = "";
|
||||
if(theIO->hasEntry()){
|
||||
if(FindActorByEntry(theIO->getEntry())){
|
||||
TColStd_IndexedMapOfInteger aMapIndex;
|
||||
theMgr->GetIndexes(theIO,aMapIndex);
|
||||
typedef set<int> TIdContainer;
|
||||
TIdContainer anIdContainer;
|
||||
for( int i = 1; i <= aMapIndex.Extent(); i++)
|
||||
anIdContainer.insert(aMapIndex(i));
|
||||
TIdContainer::const_iterator anIter = anIdContainer.begin();
|
||||
for(; anIter != anIdContainer.end(); anIter++){
|
||||
theName += QString(" %1").arg(*anIter);
|
||||
}
|
||||
return aMapIndex.Extent();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int GetNameOfSelectedElements(SalomeApp_SelectionMgr *theMgr, QString& theName)
|
||||
{
|
||||
theName = "";
|
||||
SALOME_ListIO selected; theMgr->selectedObjects( selected );
|
||||
|
||||
if( selected.Extent() == 1){
|
||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||
return GetNameOfSelectedElements(theMgr,anIO,theName);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int GetSelected(SalomeApp_SelectionMgr* theMgr,
|
||||
TColStd_IndexedMapOfInteger& theMap,
|
||||
const bool theIsElement)
|
||||
{
|
||||
theMap.Clear();
|
||||
SALOME_ListIO selected; theMgr->selectedObjects( selected );
|
||||
|
||||
if ( selected.Extent() == 1 )
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||
if ( anIO->hasEntry() ) {
|
||||
theMgr->GetIndexes( anIO, theMap );
|
||||
}
|
||||
}
|
||||
return theMap.Extent();
|
||||
}
|
||||
|
||||
|
||||
int GetEdgeNodes( SalomeApp_SelectionMgr* theMgr, int& theId1, int& theId2 )
|
||||
{
|
||||
SALOME_ListIO selected; theMgr->selectedObjects( selected );
|
||||
|
||||
if ( selected.Extent() != 1 )
|
||||
return -1;
|
||||
|
||||
Handle(SALOME_InteractiveObject) anIO = selected.First();
|
||||
if ( anIO.IsNull() || !anIO->hasEntry() )
|
||||
return -1;
|
||||
|
||||
SMESH_Actor *anActor = SMESH::FindActorByEntry( anIO->getEntry() );
|
||||
if ( anActor == 0 )
|
||||
return -1;
|
||||
|
||||
TColStd_IndexedMapOfInteger aMapIndex;
|
||||
theMgr->GetIndexes( anIO, aMapIndex );
|
||||
if ( aMapIndex.Extent() != 2 )
|
||||
return -1;
|
||||
|
||||
int anObjId = -1, anEdgeNum = -1;
|
||||
for ( int i = 1; i <= aMapIndex.Extent(); i++ ) {
|
||||
int aVal = aMapIndex( i );
|
||||
if ( aVal > 0 )
|
||||
anObjId = aVal;
|
||||
else
|
||||
anEdgeNum = abs( aVal );
|
||||
}
|
||||
|
||||
if ( anObjId == -1 || anEdgeNum == -1 )
|
||||
return -1;
|
||||
|
||||
return anActor->GetObject()->GetEdgeNodes( anObjId, anEdgeNum, theId1, theId2 ) ? 1 : -1;
|
||||
}
|
||||
|
||||
void SetControlsPrecision( const long theVal )
|
||||
{
|
||||
if( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView() )
|
||||
{
|
||||
vtkRenderer *aRenderer = aWnd->getRenderer();
|
||||
vtkActorCollection *aCollection = aRenderer->GetActors();
|
||||
aCollection->InitTraversal();
|
||||
|
||||
while ( vtkActor *anAct = aCollection->GetNextActor())
|
||||
{
|
||||
if ( SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>( anAct ) )
|
||||
{
|
||||
anActor->SetControlsPrecision( theVal );
|
||||
anActor->SetControlMode( anActor->GetControlMode() );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
89
src/SMESH_I/SMESH_1D_Algo_i.cxx
Normal file
89
src/SMESH_I/SMESH_1D_Algo_i.cxx
Normal file
@ -0,0 +1,89 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_1D_Algo_i.cxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
#include "SMESH_1D_Algo_i.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_1D_Algo_i::SMESH_1D_Algo_i
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_1D_Algo_i::SMESH_1D_Algo_i( PortableServer::POA_ptr thePOA )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA ),
|
||||
SMESH_Algo_i( thePOA )
|
||||
{
|
||||
MESSAGE( "SMESH_1D_Algo_i::SMESH_1D_Algo_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_1D_Algo_i::~SMESH_1D_Algo_i
|
||||
*
|
||||
* Destructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_1D_Algo_i::~SMESH_1D_Algo_i()
|
||||
{
|
||||
MESSAGE( "SMESH_1D_Algo_i::~SMESH_1D_Algo_i" );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether algorithm supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether algorithm supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
CORBA::Boolean SMESH_1D_Algo_i::IsDimSupported( SMESH::Dimension type )
|
||||
{
|
||||
return type == SMESH::DIM_1D;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
56
src/SMESH_I/SMESH_1D_Algo_i.hxx
Normal file
56
src/SMESH_I/SMESH_1D_Algo_i.hxx
Normal file
@ -0,0 +1,56 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_1D_Algo_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_1D_ALGO_I_HXX_
|
||||
#define _SMESH_1D_ALGO_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
|
||||
#include "SMESH_Algo_i.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Generic 1D algorithm
|
||||
// ======================================================
|
||||
class SMESH_1D_Algo_i:
|
||||
public virtual POA_SMESH::SMESH_1D_Algo,
|
||||
public virtual SMESH_Algo_i
|
||||
{
|
||||
protected:
|
||||
// Constructor : placed in protected section to prohibit creation of generic class instance
|
||||
SMESH_1D_Algo_i( PortableServer::POA_ptr thePOA );
|
||||
|
||||
public:
|
||||
// Destructor
|
||||
virtual ~SMESH_1D_Algo_i();
|
||||
|
||||
// Verify whether algorithm supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
75
src/SMESH_I/SMESH_2D_Algo_i.cxx
Normal file
75
src/SMESH_I/SMESH_2D_Algo_i.cxx
Normal file
@ -0,0 +1,75 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_2D_Algo_i.cxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
#include "SMESH_2D_Algo_i.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_2D_Algo_i::SMESH_2D_Algo_i
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_2D_Algo_i::SMESH_2D_Algo_i( PortableServer::POA_ptr thePOA )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA ),
|
||||
SMESH_Algo_i( thePOA )
|
||||
{
|
||||
MESSAGE( "SMESH_2D_Algo_i::SMESH_2D_Algo_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_2D_Algo_i::~SMESH_2D_Algo_i
|
||||
*
|
||||
* Destructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_2D_Algo_i::~SMESH_2D_Algo_i()
|
||||
{
|
||||
MESSAGE( "SMESH_2D_Algo_i::~SMESH_2D_Algo_i" );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether algorithm supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether algorithm supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
CORBA::Boolean SMESH_2D_Algo_i::IsDimSupported( SMESH::Dimension type )
|
||||
{
|
||||
return type == SMESH::DIM_2D;
|
||||
}
|
56
src/SMESH_I/SMESH_2D_Algo_i.hxx
Normal file
56
src/SMESH_I/SMESH_2D_Algo_i.hxx
Normal file
@ -0,0 +1,56 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_2D_Algo_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_2D_ALGO_I_HXX_
|
||||
#define _SMESH_2D_ALGO_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
|
||||
#include "SMESH_Algo_i.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Generic 2D algorithm
|
||||
// ======================================================
|
||||
class SMESH_2D_Algo_i:
|
||||
public virtual POA_SMESH::SMESH_2D_Algo,
|
||||
public virtual SMESH_Algo_i
|
||||
{
|
||||
protected:
|
||||
// Constructor : placed in protected section to prohibit creation of generic class instance
|
||||
SMESH_2D_Algo_i( PortableServer::POA_ptr thePOA );
|
||||
|
||||
public:
|
||||
// Destructor
|
||||
virtual ~SMESH_2D_Algo_i();
|
||||
|
||||
// Verify whether algorithm supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
76
src/SMESH_I/SMESH_3D_Algo_i.cxx
Normal file
76
src/SMESH_I/SMESH_3D_Algo_i.cxx
Normal file
@ -0,0 +1,76 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_3D_Algo_i.cxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
#include "SMESH_3D_Algo_i.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_3D_Algo_i::SMESH_3D_Algo_i
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_3D_Algo_i::SMESH_3D_Algo_i( PortableServer::POA_ptr thePOA )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA ),
|
||||
SMESH_Algo_i( thePOA )
|
||||
{
|
||||
MESSAGE( "SMESH_3D_Algo_i::SMESH_3D_Algo_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_3D_Algo_i::~SMESH_3D_Algo_i
|
||||
*
|
||||
* Destructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_3D_Algo_i::~SMESH_3D_Algo_i()
|
||||
{
|
||||
MESSAGE( "SMESH_3D_Algo_i::~SMESH_3D_Algo_i" );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether algorithm supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether algorithm supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
CORBA::Boolean SMESH_3D_Algo_i::IsDimSupported( SMESH::Dimension type )
|
||||
{
|
||||
return type == SMESH::DIM_3D;
|
||||
}
|
||||
|
56
src/SMESH_I/SMESH_3D_Algo_i.hxx
Normal file
56
src/SMESH_I/SMESH_3D_Algo_i.hxx
Normal file
@ -0,0 +1,56 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_3D_Algo_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_3D_ALGO_I_HXX_
|
||||
#define _SMESH_3D_ALGO_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
|
||||
#include "SMESH_Algo_i.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Generic 3D algorithm
|
||||
// ======================================================
|
||||
class SMESH_3D_Algo_i:
|
||||
public virtual POA_SMESH::SMESH_3D_Algo,
|
||||
public virtual SMESH_Algo_i
|
||||
{
|
||||
protected:
|
||||
// Constructor : placed in protected section to prohibit creation of generic class instance
|
||||
SMESH_3D_Algo_i( PortableServer::POA_ptr thePOA );
|
||||
|
||||
public:
|
||||
// Destructor
|
||||
virtual ~SMESH_3D_Algo_i();
|
||||
|
||||
// Verify whether algorithm supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
268
src/SMESH_I/SMESH_Mesh_i.hxx
Normal file
268
src/SMESH_I/SMESH_Mesh_i.hxx
Normal file
@ -0,0 +1,268 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_Mesh_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_MESH_I_HXX_
|
||||
#define _SMESH_MESH_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
#include CORBA_CLIENT_HEADER(GEOM_Gen)
|
||||
#include CORBA_CLIENT_HEADER(MED)
|
||||
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_subMesh_i.hxx"
|
||||
#include "SMESH_subMesh.hxx"
|
||||
|
||||
#include "SALOME_GenericObj_i.hh"
|
||||
|
||||
class SMESH_Gen_i;
|
||||
class SMESH_GroupBase_i;
|
||||
|
||||
#include <map>
|
||||
|
||||
class SMESH_Mesh_i:
|
||||
public virtual POA_SMESH::SMESH_Mesh,
|
||||
public virtual SALOME::GenericObj_i
|
||||
{
|
||||
SMESH_Mesh_i();
|
||||
SMESH_Mesh_i(const SMESH_Mesh_i&);
|
||||
public:
|
||||
SMESH_Mesh_i( PortableServer::POA_ptr thePOA,
|
||||
SMESH_Gen_i* myGen_i,
|
||||
CORBA::Long studyId );
|
||||
|
||||
virtual ~SMESH_Mesh_i();
|
||||
|
||||
// --- CORBA
|
||||
void SetShape( GEOM::GEOM_Object_ptr theShapeObject )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
GEOM::GEOM_Object_ptr GetShapeToMesh()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
|
||||
SMESH::SMESH_Hypothesis_ptr anHyp)
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::Hypothesis_Status RemoveHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
|
||||
SMESH::SMESH_Hypothesis_ptr anHyp)
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::ListOfHypothesis* GetHypothesisList(GEOM::GEOM_Object_ptr aSubShapeObject)
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::SMESH_subMesh_ptr GetSubMesh(GEOM::GEOM_Object_ptr aSubShapeObject, const char* theName)
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
void RemoveSubMesh( SMESH::SMESH_subMesh_ptr theSubMesh )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::SMESH_Group_ptr CreateGroup( SMESH::ElementType theElemType, const char* theName )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::SMESH_GroupOnGeom_ptr CreateGroupFromGEOM(SMESH::ElementType theElemType,
|
||||
const char* theName,
|
||||
GEOM::GEOM_Object_ptr theGeomObj )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
void RemoveGroup( SMESH::SMESH_GroupBase_ptr theGroup )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
void RemoveGroupWithContents( SMESH::SMESH_GroupBase_ptr theGroup )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::SMESH_Group_ptr UnionGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
|
||||
SMESH::SMESH_GroupBase_ptr theGroup2,
|
||||
const char* theName )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::SMESH_Group_ptr IntersectGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
|
||||
SMESH::SMESH_GroupBase_ptr theGroup2,
|
||||
const char* theName )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::SMESH_Group_ptr CutGroups( SMESH::SMESH_GroupBase_ptr theGroup1,
|
||||
SMESH::SMESH_GroupBase_ptr theGroup2,
|
||||
const char* theName )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
// SMESH::string_array* GetLog(CORBA::Boolean clearAfterGet)
|
||||
// throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::log_array* GetLog(CORBA::Boolean clearAfterGet)
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::SMESH_MeshEditor_ptr GetMeshEditor();
|
||||
|
||||
void ClearLog()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long GetId()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long GetStudyId()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
// --- C++ interface
|
||||
|
||||
void SetImpl(::SMESH_Mesh* impl);
|
||||
::SMESH_Mesh& GetImpl(); // :: force no namespace here
|
||||
|
||||
SMESH_Gen_i* GetGen() { return _gen_i; }
|
||||
|
||||
int ImportUNVFile( const char* theFileName )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
int ImportSTLFile( const char* theFileName )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
|
||||
*/
|
||||
SMESH::DriverMED_ReadStatus ImportMEDFile( const char* theFileName, const char* theMeshName )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
void ExportToMED( const char* file, CORBA::Boolean auto_groups, SMESH::MED_VERSION theVersion )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
void ExportMED( const char* file, CORBA::Boolean auto_groups )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
void ExportDAT( const char* file )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
void ExportUNV( const char* file )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
void ExportSTL( const char* file, const bool isascii )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SALOME_MED::MESH_ptr GetMEDMesh()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbNodes()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbElements()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbEdges()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbFaces()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbTriangles()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbQuadrangles()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbPolygons()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbVolumes()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbTetras()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbHexas()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbPyramids()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbPrisms()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbPolyhedrons()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long NbSubMesh()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::long_array* GetElementsId()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::long_array* GetNodesId()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::ElementType GetElementType( const CORBA::Long id, const bool iselem )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
char* Dump();
|
||||
|
||||
// Internal methods not available through CORBA
|
||||
// They are called by corresponding interface methods
|
||||
SMESH_Hypothesis::Hypothesis_Status addHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
|
||||
SMESH::SMESH_Hypothesis_ptr anHyp);
|
||||
|
||||
SMESH_Hypothesis::Hypothesis_Status removeHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
|
||||
SMESH::SMESH_Hypothesis_ptr anHyp);
|
||||
|
||||
int importMEDFile( const char* theFileName, const char* theMeshName );
|
||||
|
||||
SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject );
|
||||
|
||||
void removeSubMesh(SMESH::SMESH_subMesh_ptr theSubMesh,
|
||||
GEOM::GEOM_Object_ptr theSubShapeObject );
|
||||
|
||||
SMESH::SMESH_GroupBase_ptr createGroup(SMESH::ElementType theElemType,
|
||||
const char* theName,
|
||||
const TopoDS_Shape& theShape = TopoDS_Shape());
|
||||
|
||||
void removeGroup( const int theId );
|
||||
|
||||
SMESH::SMESH_subMesh_ptr getSubMesh(int shapeID);
|
||||
// return an existing subMesh object for the shapeID. shapeID == submeshID.
|
||||
|
||||
const map<int, SMESH::SMESH_GroupBase_ptr>& getGroups() { return _mapGroups; }
|
||||
// return an existing group object.
|
||||
|
||||
virtual SMESH::long_array* GetIDs();
|
||||
|
||||
map<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
|
||||
map<int, ::SMESH_subMesh*> _mapSubMesh; //NRI
|
||||
|
||||
private:
|
||||
static int myIdGenerator;
|
||||
::SMESH_Mesh* _impl; // :: force no namespace here
|
||||
SMESH_Gen_i* _gen_i;
|
||||
int _id; // id given by creator (unique within the creator instance)
|
||||
int _studyId;
|
||||
map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
|
||||
map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
|
||||
map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
487
src/SMESH_I/SMESH_subMesh_i.cxx
Normal file
487
src/SMESH_I/SMESH_subMesh_i.cxx
Normal file
@ -0,0 +1,487 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_subMesh_i.cxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
#include "SMESH_subMesh_i.hxx"
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_Mesh_i.hxx"
|
||||
|
||||
#include "Utils_CorbaException.hxx"
|
||||
#include "utilities.h"
|
||||
#include "OpUtil.hxx"
|
||||
#include "Utils_ExceptHandlers.hxx"
|
||||
|
||||
#include <BRepTools.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_subMesh_i::SMESH_subMesh_i()
|
||||
: SALOME::GenericObj_i( PortableServer::POA::_nil() )
|
||||
{
|
||||
MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i default, not for use");
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_subMesh_i::SMESH_subMesh_i( PortableServer::POA_ptr thePOA,
|
||||
SMESH_Gen_i* gen_i,
|
||||
SMESH_Mesh_i* mesh_i,
|
||||
int localId )
|
||||
: SALOME::GenericObj_i( thePOA )
|
||||
{
|
||||
MESSAGE("SMESH_subMesh_i::SMESH_subMesh_i");
|
||||
_gen_i = gen_i;
|
||||
_mesh_i = mesh_i;
|
||||
_localId = localId;
|
||||
thePOA->activate_object( this );
|
||||
// ****
|
||||
}
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH_subMesh_i::~SMESH_subMesh_i()
|
||||
{
|
||||
MESSAGE("SMESH_subMesh_i::~SMESH_subMesh_i");
|
||||
// ****
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getSubMeshes
|
||||
//purpose : for a submesh on shape to which elements are not bound directly,
|
||||
// return submeshes containing elements
|
||||
//=======================================================================
|
||||
|
||||
typedef list<SMESHDS_SubMesh*> TListOfSubMeshes;
|
||||
|
||||
bool getSubMeshes(::SMESH_subMesh* theSubMesh,
|
||||
TListOfSubMeshes& theSubMeshList)
|
||||
{
|
||||
int size = theSubMeshList.size();
|
||||
|
||||
SMESH_Mesh* aMesh = theSubMesh->GetFather();
|
||||
SMESHDS_Mesh* aMeshDS = aMesh->GetMeshDS();
|
||||
SMESHDS_SubMesh* aSubMeshDS = theSubMesh->GetSubMeshDS();
|
||||
|
||||
// nodes can be bound to either vertex, edge, face or solid_or_shell
|
||||
TopoDS_Shape aShape = theSubMesh->GetSubShape();
|
||||
switch ( aShape.ShapeType() )
|
||||
{
|
||||
case TopAbs_SOLID: {
|
||||
// add submesh of solid itself
|
||||
aSubMeshDS = aMeshDS->MeshElements( aShape );
|
||||
if ( aSubMeshDS )
|
||||
theSubMeshList.push_back( aSubMeshDS );
|
||||
// and of the first shell
|
||||
TopExp_Explorer exp( aShape, TopAbs_SHELL );
|
||||
if ( exp.More() ) {
|
||||
aSubMeshDS = aMeshDS->MeshElements( exp.Current() );
|
||||
if ( aSubMeshDS )
|
||||
theSubMeshList.push_back( aSubMeshDS );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case TopAbs_WIRE:
|
||||
case TopAbs_COMPOUND:
|
||||
case TopAbs_COMPSOLID: {
|
||||
// call getSubMeshes() for sub-shapes
|
||||
list<TopoDS_Shape> shapeList;
|
||||
shapeList.push_back( aShape );
|
||||
list<TopoDS_Shape>::iterator sh = shapeList.begin();
|
||||
for ( ; sh != shapeList.end(); ++sh ) {
|
||||
for ( TopoDS_Iterator it( *sh ); it.More(); it.Next() ) {
|
||||
::SMESH_subMesh* aSubMesh = aMesh->GetSubMeshContaining( it.Value() );
|
||||
if ( aSubMesh )
|
||||
getSubMeshes( aSubMesh, theSubMeshList );
|
||||
else
|
||||
// no submesh for a compound inside compound
|
||||
shapeList.push_back( it.Value() );
|
||||
}
|
||||
}
|
||||
// return only unique submeshes
|
||||
set<SMESHDS_SubMesh*> smSet;
|
||||
TListOfSubMeshes::iterator sm = theSubMeshList.begin();
|
||||
while ( sm != theSubMeshList.end() ) {
|
||||
if ( !smSet.insert( *sm ).second )
|
||||
sm = theSubMeshList.erase( sm );
|
||||
else
|
||||
++sm;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return size < theSubMeshList.size();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Long SMESH_subMesh_i::GetNumberOfElements()
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
MESSAGE("SMESH_subMesh_i::GetNumberOfElements");
|
||||
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
||||
return 0;
|
||||
|
||||
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
||||
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
||||
|
||||
int nbElems = aSubMeshDS ? aSubMeshDS->NbElements() : 0;
|
||||
|
||||
// volumes are bound to shell
|
||||
TListOfSubMeshes smList;
|
||||
if ( nbElems == 0 && getSubMeshes( aSubMesh, smList ))
|
||||
{
|
||||
TListOfSubMeshes::iterator sm = smList.begin();
|
||||
for ( ; sm != smList.end(); ++sm )
|
||||
nbElems += (*sm)->NbElements();
|
||||
}
|
||||
return nbElems;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Long SMESH_subMesh_i::GetNumberOfNodes(CORBA::Boolean all)
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
MESSAGE("SMESH_subMesh_i::GetNumberOfNodes");
|
||||
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
||||
return 0;
|
||||
|
||||
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
||||
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
||||
|
||||
set<int> nodeIds;
|
||||
|
||||
// nodes are bound to shell instead of solid
|
||||
TListOfSubMeshes smList;
|
||||
if ( all && getSubMeshes( aSubMesh, smList ))
|
||||
{
|
||||
TListOfSubMeshes::iterator sm = smList.begin();
|
||||
for ( ; sm != smList.end(); ++sm )
|
||||
{
|
||||
SMDS_ElemIteratorPtr eIt = (*sm)->GetElements();
|
||||
while ( eIt->more() ) {
|
||||
const SMDS_MeshElement* anElem = eIt->next();
|
||||
SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
|
||||
while ( nIt->more() )
|
||||
nodeIds.insert( nIt->next()->GetID() );
|
||||
}
|
||||
}
|
||||
return nodeIds.size();
|
||||
}
|
||||
|
||||
if ( aSubMeshDS == NULL )
|
||||
return 0;
|
||||
|
||||
if ( all ) { // all nodes of submesh elements
|
||||
SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
|
||||
while ( eIt->more() ) {
|
||||
const SMDS_MeshElement* anElem = eIt->next();
|
||||
SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
|
||||
while ( nIt->more() )
|
||||
nodeIds.insert( nIt->next()->GetID() );
|
||||
}
|
||||
return nodeIds.size();
|
||||
}
|
||||
|
||||
return aSubMeshDS->NbNodes();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::long_array* SMESH_subMesh_i::GetElementsId()
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
MESSAGE("SMESH_subMesh_i::GetElementsId");
|
||||
SMESH::long_array_var aResult = new SMESH::long_array();
|
||||
|
||||
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
||||
return aResult._retn();
|
||||
|
||||
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
||||
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
||||
|
||||
int nbElems = aSubMeshDS ? aSubMeshDS->NbElements() : 0;
|
||||
TListOfSubMeshes smList;
|
||||
if ( nbElems )
|
||||
smList.push_back( aSubMeshDS );
|
||||
|
||||
// volumes are bound to shell
|
||||
if ( nbElems == 0 && getSubMeshes( aSubMesh, smList ))
|
||||
{
|
||||
TListOfSubMeshes::iterator sm = smList.begin();
|
||||
for ( ; sm != smList.end(); ++sm )
|
||||
nbElems += (*sm)->NbElements();
|
||||
}
|
||||
|
||||
aResult->length( nbElems );
|
||||
if ( nbElems )
|
||||
{
|
||||
TListOfSubMeshes::iterator sm = smList.begin();
|
||||
for ( int i = 0; sm != smList.end(); sm++ )
|
||||
{
|
||||
SMDS_ElemIteratorPtr anIt = (*sm)->GetElements();
|
||||
for ( int n = aSubMeshDS->NbElements(); i < n && anIt->more(); i++ )
|
||||
aResult[i] = anIt->next()->GetID();
|
||||
}
|
||||
}
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::long_array* SMESH_subMesh_i::GetElementsByType( SMESH::ElementType theElemType )
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
MESSAGE("SMESH_subMesh_i::GetElementsByType");
|
||||
SMESH::long_array_var aResult = new SMESH::long_array();
|
||||
|
||||
if ( _mesh_i->_mapSubMesh.find( _localId ) == _mesh_i->_mapSubMesh.end() )
|
||||
return aResult._retn();
|
||||
|
||||
::SMESH_subMesh* aSubMesh = _mesh_i->_mapSubMesh[_localId];
|
||||
SMESHDS_SubMesh* aSubMeshDS = aSubMesh->GetSubMeshDS();
|
||||
|
||||
// PAL5440, return all nodes belonging to elements of submesh
|
||||
set<int> nodeIds;
|
||||
int nbElems = aSubMeshDS ? aSubMeshDS->NbElements() : 0;
|
||||
|
||||
// volumes may be bound to shell instead of solid
|
||||
TListOfSubMeshes smList;
|
||||
if ( nbElems == 0 && getSubMeshes( aSubMesh, smList ))
|
||||
{
|
||||
TListOfSubMeshes::iterator sm = smList.begin();
|
||||
for ( ; sm != smList.end(); ++sm )
|
||||
{
|
||||
if ( theElemType == SMESH::NODE )
|
||||
{
|
||||
SMDS_ElemIteratorPtr eIt = (*sm)->GetElements();
|
||||
while ( eIt->more() ) {
|
||||
const SMDS_MeshElement* anElem = eIt->next();
|
||||
SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
|
||||
while ( nIt->more() )
|
||||
nodeIds.insert( nIt->next()->GetID() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
nbElems += (*sm)->NbElements();
|
||||
}
|
||||
}
|
||||
aSubMeshDS = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( nbElems )
|
||||
smList.push_back( aSubMeshDS );
|
||||
}
|
||||
|
||||
if ( theElemType == SMESH::NODE && aSubMeshDS )
|
||||
{
|
||||
SMDS_ElemIteratorPtr eIt = aSubMeshDS->GetElements();
|
||||
while ( eIt->more() ) {
|
||||
const SMDS_MeshElement* anElem = eIt->next();
|
||||
SMDS_ElemIteratorPtr nIt = anElem->nodesIterator();
|
||||
while ( nIt->more() )
|
||||
nodeIds.insert( nIt->next()->GetID() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( theElemType == SMESH::NODE )
|
||||
aResult->length( nodeIds.size() );
|
||||
else
|
||||
aResult->length( nbElems );
|
||||
|
||||
int i = 0, n = aResult->length();
|
||||
|
||||
if ( theElemType == SMESH::NODE && !nodeIds.empty() ) {
|
||||
set<int>::iterator idIt = nodeIds.begin();
|
||||
for ( ; i < n && idIt != nodeIds.end() ; i++, idIt++ )
|
||||
aResult[i] = *idIt;
|
||||
}
|
||||
|
||||
if ( theElemType != SMESH::NODE ) {
|
||||
TListOfSubMeshes::iterator sm = smList.begin();
|
||||
for ( i = 0; sm != smList.end(); sm++ )
|
||||
{
|
||||
aSubMeshDS = *sm;
|
||||
SMDS_ElemIteratorPtr anIt = aSubMeshDS->GetElements();
|
||||
while ( i < n && anIt->more() ) {
|
||||
const SMDS_MeshElement* anElem = anIt->next();
|
||||
if ( theElemType == SMESH::ALL || anElem->GetType() == (SMDSAbs_ElementType)theElemType )
|
||||
aResult[i++] = anElem->GetID();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aResult->length( i );
|
||||
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::long_array* SMESH_subMesh_i::GetNodesId()
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
MESSAGE("SMESH_subMesh_i::GetNodesId");
|
||||
SMESH::long_array_var aResult = GetElementsByType( SMESH::NODE );
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetFather()
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
MESSAGE("SMESH_subMesh_i::GetFather");
|
||||
return _mesh_i->_this();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Long SMESH_subMesh_i::GetId()
|
||||
{
|
||||
MESSAGE("SMESH_subMesh_i::GetId");
|
||||
return _localId;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetSubShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
GEOM::GEOM_Object_ptr SMESH_subMesh_i::GetSubShape()
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
GEOM::GEOM_Object_var aShapeObj;
|
||||
try {
|
||||
if ( _mesh_i->_mapSubMesh.find( _localId ) != _mesh_i->_mapSubMesh.end()) {
|
||||
TopoDS_Shape S = _mesh_i->_mapSubMesh[ _localId ]->GetSubShape();
|
||||
if ( !S.IsNull() )
|
||||
aShapeObj = _gen_i->ShapeToGeomObject( S );
|
||||
}
|
||||
}
|
||||
catch(SALOME_Exception & S_ex) {
|
||||
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
|
||||
}
|
||||
return aShapeObj._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
SALOME_MED::FAMILY_ptr SMESH_subMesh_i::GetFamily()
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
SALOME_MED::MESH_var MEDMesh = GetFather()->GetMEDMesh();
|
||||
|
||||
SALOME_MED::Family_array_var families =
|
||||
MEDMesh->getFamilies(SALOME_MED::MED_NODE);
|
||||
|
||||
for ( int i = 0; i < families->length(); i++ ) {
|
||||
if ( families[i]->getIdentifier() == ( _localId ) )
|
||||
return families[i];
|
||||
}
|
||||
|
||||
return SALOME_MED::FAMILY::_nil();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
SMESH::long_array* SMESH_subMesh_i::GetIDs()
|
||||
{
|
||||
SMESH::long_array_var aResult = GetElementsId();
|
||||
return aResult._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
SMESH::ElementType SMESH_subMesh_i::GetElementType( const CORBA::Long id, const bool iselem )
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
return GetFather()->GetElementType( id, iselem );
|
||||
}
|
93
src/SMESH_I/SMESH_subMesh_i.hxx
Normal file
93
src/SMESH_I/SMESH_subMesh_i.hxx
Normal file
@ -0,0 +1,93 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : SMESH_subMesh_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_SUBMESH_I_HXX_
|
||||
#define _SMESH_SUBMESH_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
#include CORBA_CLIENT_HEADER(GEOM_Gen)
|
||||
#include CORBA_CLIENT_HEADER(MED)
|
||||
|
||||
#include "SALOME_GenericObj_i.hh"
|
||||
|
||||
class SMESH_Gen_i;
|
||||
class SMESH_Mesh_i;
|
||||
|
||||
class SMESH_subMesh_i:
|
||||
public virtual POA_SMESH::SMESH_subMesh,
|
||||
public virtual SALOME::GenericObj_i
|
||||
{
|
||||
public:
|
||||
SMESH_subMesh_i();
|
||||
SMESH_subMesh_i( PortableServer::POA_ptr thePOA,
|
||||
SMESH_Gen_i* gen_i,
|
||||
SMESH_Mesh_i* mesh_i,
|
||||
int localId );
|
||||
~SMESH_subMesh_i();
|
||||
|
||||
CORBA::Long GetNumberOfElements()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long GetNumberOfNodes( CORBA::Boolean all )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::long_array* GetElementsId()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::long_array* GetElementsByType( SMESH::ElementType theElemType )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::ElementType GetElementType( const CORBA::Long id, const bool iselem )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::long_array* GetNodesId()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
SMESH::SMESH_Mesh_ptr GetFather()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
GEOM::GEOM_Object_ptr GetSubShape()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Long GetId();
|
||||
|
||||
SALOME_MED::FAMILY_ptr GetFamily()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
virtual SMESH::long_array* GetIDs();
|
||||
|
||||
SMESH_Mesh_i* _mesh_i; //NRI
|
||||
|
||||
protected:
|
||||
SMESH_Gen_i* _gen_i;
|
||||
int _localId;
|
||||
};
|
||||
|
||||
#endif
|
120
src/SMESH_SWIG/Makefile.in
Normal file
120
src/SMESH_SWIG/Makefile.in
Normal file
@ -0,0 +1,120 @@
|
||||
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
#
|
||||
#
|
||||
#
|
||||
# File : Makefile.in
|
||||
# Author : Nicolas REJNERI, Paul RASCLE
|
||||
# Module : SMESH
|
||||
# $Header$
|
||||
|
||||
top_srcdir=@top_srcdir@
|
||||
top_builddir=../..
|
||||
srcdir=@srcdir@
|
||||
VPATH=.:@srcdir@:@top_srcdir@/idl
|
||||
|
||||
|
||||
@COMMENCE@
|
||||
|
||||
# Libraries targets
|
||||
|
||||
LIB = libSMESH_Swigcmodule.la
|
||||
LIB_SRC =
|
||||
|
||||
SWIG_DEF = libSMESH_Swig.i
|
||||
EXPORT_PYSCRIPTS = libSMESH_Swig.py \
|
||||
smesh.py \
|
||||
batchmode_smesh.py \
|
||||
batchmode_mefisto.py \
|
||||
ex00_all.py \
|
||||
ex01_cube2build.py \
|
||||
ex02_cube2primitive.py \
|
||||
ex03_cube2partition.py \
|
||||
ex04_cube5tetraHexa.py \
|
||||
ex05_hole1build.py \
|
||||
ex06_hole1boolean.py \
|
||||
ex07_hole1partition.py \
|
||||
ex08_hole2build.py \
|
||||
ex09_grid4build.py \
|
||||
ex10_grid4geometry.py \
|
||||
ex11_grid3partition.py \
|
||||
ex12_grid17partition.py \
|
||||
ex13_hole1partial.py \
|
||||
ex14_cyl1holed.py \
|
||||
ex15_cyl2geometry.py \
|
||||
ex16_cyl2complementary.py \
|
||||
ex17_dome1.py \
|
||||
ex18_dome2.py \
|
||||
ex19_sphereINcube.py \
|
||||
SMESH_test.py\
|
||||
SMESH_test0.py\
|
||||
SMESH_test1.py \
|
||||
SMESH_test2.py \
|
||||
SMESH_test3.py \
|
||||
SMESH_test4.py \
|
||||
SMESH_test5.py \
|
||||
SMESH_mechanic.py \
|
||||
SMESH_mechanic_tetra.py \
|
||||
SMESH_mechanic_editor.py \
|
||||
SMESH_fixation.py \
|
||||
SMESH_fixation_hexa.py \
|
||||
SMESH_fixation_tetra.py \
|
||||
SMESH_box_tetra.py \
|
||||
SMESH_box2_tetra.py \
|
||||
SMESH_box3_tetra.py \
|
||||
SMESH_flight_skin.py \
|
||||
SMESH_Partition1_tetra.py\
|
||||
SMESH_controls.py \
|
||||
SMESH_freebord.py \
|
||||
SMESH_blocks.py \
|
||||
SMESH_BelongToGeom.py \
|
||||
SMESH_GroupFromGeom2.py \
|
||||
SMESH_box.py \
|
||||
SMESH_demo_hexa2_upd.py \
|
||||
SMESH_hexaedre.py \
|
||||
SMESH_Sphere.py \
|
||||
SMESH_GroupFromGeom.py \
|
||||
SMESH_Nut.py \
|
||||
SMESH_GroupLyingOnGeom.py \
|
||||
PAL_MESH_041_mesh.py \
|
||||
PAL_MESH_043_2D.py \
|
||||
PAL_MESH_043_3D.py \
|
||||
SMESH_reg.py
|
||||
|
||||
LIB_CLIENT_IDL = SALOMEDS.idl \
|
||||
SALOME_Exception.idl \
|
||||
GEOM_Gen.idl \
|
||||
SMESH_Gen.idl \
|
||||
SMESH_Mesh.idl \
|
||||
SMESH_Hypothesis.idl \
|
||||
SMESH_BasicHypothesis.idl \
|
||||
SMESH_Group.idl \
|
||||
SALOME_ModuleCatalog.idl \
|
||||
SALOME_Component.idl \
|
||||
SALOME_GenericObj.idl \
|
||||
MED.idl \
|
||||
SALOME_Comm.idl
|
||||
|
||||
EXPORT_SHAREDPYSCRIPTS=SMESH_shared_modules.py
|
||||
|
||||
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -DHAVE_CONFIG_H
|
||||
LIBS+= $(PYTHON_LIBS)
|
||||
LDFLAGS+= -lSMESH -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeGenericObj
|
||||
|
||||
@CONCLUDE@
|
200
src/SMESH_SWIG/SMESH_test.py
Normal file
200
src/SMESH_SWIG/SMESH_test.py
Normal file
@ -0,0 +1,200 @@
|
||||
# SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
#
|
||||
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
#
|
||||
#
|
||||
#
|
||||
# File : SMESH_test.py
|
||||
# Module : SMESH
|
||||
|
||||
import salome
|
||||
import geompy
|
||||
import smeshpy
|
||||
|
||||
import SMESH
|
||||
import StdMeshers
|
||||
|
||||
# ---- define a box
|
||||
|
||||
box = geompy.MakeBox(0., 0., 0., 100., 200., 300.)
|
||||
idb = geompy.addToStudy(box, "box")
|
||||
|
||||
# ---- add first face of box in study
|
||||
|
||||
subShapeList = geompy.SubShapeAll(box, geompy.ShapeType["FACE"])
|
||||
face = subShapeList[0]
|
||||
name = geompy.SubShapeName(face, box)
|
||||
idf = geompy.addToStudyInFather(box, face, name)
|
||||
|
||||
# ---- add shell from box in study
|
||||
|
||||
subShellList = geompy.SubShapeAll(box, geompy.ShapeType["SHELL"])
|
||||
shell = subShellList[0]
|
||||
name = geompy.SubShapeName(shell, box)
|
||||
ids = geompy.addToStudyInFather(box, shell, name)
|
||||
|
||||
# ---- add first edge of face in study
|
||||
|
||||
edgeList = geompy.SubShapeAll(face, geompy.ShapeType["EDGE"])
|
||||
edge = edgeList[0];
|
||||
name = geompy.SubShapeName(edge, face)
|
||||
ide = geompy.addToStudyInFather(face, edge, name)
|
||||
|
||||
# ---- launch SMESH, init a Mesh with the box
|
||||
|
||||
gen = smeshpy.smeshpy()
|
||||
mesh = gen.CreateMesh(idb)
|
||||
|
||||
print "-------------------------- create Hypothesis"
|
||||
|
||||
print "-------------------------- LocalLength"
|
||||
|
||||
hypo1 = gen.CreateHypothesis("LocalLength", "libStdMeshersEngine.so")
|
||||
print hypo1.GetName()
|
||||
print hypo1.GetId()
|
||||
print hypo1.GetLength()
|
||||
hypo1.SetLength(100)
|
||||
print hypo1.GetLength()
|
||||
|
||||
print "-------------------------- bidon"
|
||||
|
||||
hyp3 = gen.CreateHypothesis("bidon", "")
|
||||
|
||||
print "-------------------------- NumberOfSegments"
|
||||
|
||||
hypo3 = gen.CreateHypothesis("NumberOfSegments", "libStdMeshersEngine.so")
|
||||
hypo3.SetNumberOfSegments(7)
|
||||
print hypo3.GetName()
|
||||
print hypo3.GetNumberOfSegments()
|
||||
print hypo3.GetId()
|
||||
|
||||
print "-------------------------- MaxElementArea"
|
||||
|
||||
hypo4 = gen.CreateHypothesis("MaxElementArea", "libStdMeshersEngine.so")
|
||||
hypo4.SetMaxElementArea(5000)
|
||||
print hypo4.GetName()
|
||||
print hypo4.GetMaxElementArea()
|
||||
print hypo4.GetId()
|
||||
|
||||
print "-------------------------- Regular_1D"
|
||||
|
||||
algo_1 = gen.CreateHypothesis("Regular_1D", "libStdMeshersEngine.so")
|
||||
print algo_1.GetName()
|
||||
print algo_1.GetId()
|
||||
listHyp = algo_1.GetCompatibleHypothesis()
|
||||
for hyp in listHyp:
|
||||
print hyp
|
||||
print algo_1.GetId()
|
||||
|
||||
print "-------------------------- MEFISTO_2D"
|
||||
|
||||
algo_2 = gen.CreateHypothesis("MEFISTO_2D", "libStdMeshersEngine.so")
|
||||
print algo_2.GetName()
|
||||
print algo_2.GetId()
|
||||
listHyp = algo_2.GetCompatibleHypothesis()
|
||||
for hyp in listHyp:
|
||||
print hyp
|
||||
print algo_2.GetId()
|
||||
|
||||
print "-------------------------- add hypothesis to edge"
|
||||
|
||||
edge = salome.IDToObject(ide)
|
||||
submesh = mesh.GetSubMesh(edge, "SubMeshEdge")
|
||||
ret = mesh.AddHypothesis(edge,algo_1)
|
||||
print ret
|
||||
ret = mesh.AddHypothesis(edge,hypo1)
|
||||
print ret
|
||||
|
||||
##print "-------------------------- compute edge"
|
||||
##ret=gen.Compute(mesh,ide)
|
||||
##print ret
|
||||
##log=mesh.GetLog(1);
|
||||
##for a in log:
|
||||
## print a
|
||||
|
||||
print "-------------------------- add hypothesis to box"
|
||||
|
||||
box = salome.IDToObject(idb)
|
||||
submesh = mesh.GetSubMesh(box, "SubMeshBox")
|
||||
ret = mesh.AddHypothesis(box,algo_1)
|
||||
print ret
|
||||
ret = mesh.AddHypothesis(box,hypo1)
|
||||
print ret
|
||||
ret = mesh.AddHypothesis(box,algo_2)
|
||||
print ret
|
||||
ret = mesh.AddHypothesis(box,hypo4)
|
||||
print ret
|
||||
|
||||
print "-------------------------- compute face"
|
||||
|
||||
ret = gen.Compute(mesh,idf)
|
||||
print ret
|
||||
log = mesh.GetLog(0) # 0 - GetLog without ClearLog after, else if 1 - ClearLog after
|
||||
for a in log:
|
||||
print "-------"
|
||||
ii = 0
|
||||
ir = 0
|
||||
comType = a.commandType
|
||||
if comType == 0:
|
||||
for i in range(a.number):
|
||||
ind = a.indexes[ii]
|
||||
ii = ii+1
|
||||
r1 = a.coords[ir]
|
||||
ir = ir+1
|
||||
r2 = a.coords[ir]
|
||||
ir = ir+1
|
||||
r3 = a.coords[ir]
|
||||
ir = ir+1
|
||||
print "AddNode %i - %g %g %g" % (ind, r1, r2, r3)
|
||||
elif comType == 1:
|
||||
for i in range(a.number):
|
||||
ind = a.indexes[ii]
|
||||
ii = ii+1
|
||||
i1 = a.indexes[ii]
|
||||
ii = ii+1
|
||||
i2 = a.indexes[ii]
|
||||
ii = ii+1
|
||||
print "AddEdge %i - %i %i" % (ind, i1, i2)
|
||||
elif comType == 2:
|
||||
for i in range(a.number):
|
||||
ind = a.indexes[ii]
|
||||
ii = ii+1
|
||||
i1 = a.indexes[ii]
|
||||
ii = ii+1
|
||||
i2 = a.indexes[ii]
|
||||
ii = ii+1
|
||||
i3 = a.indexes[ii]
|
||||
ii = ii+1
|
||||
print "AddTriangle %i - %i %i %i" % (ind, i1, i2, i3)
|
||||
|
||||
##print "-------------------------- compute box"
|
||||
##ret=gen.Compute(mesh,idb)
|
||||
##print ret
|
||||
##log=mesh.GetLog(1);
|
||||
##print log
|
||||
|
||||
##shell=salome.IDToObject(ids)
|
||||
##submesh=mesh.GetElementsOnShape(shell)
|
||||
##ret=mesh.AddHypothesis(shell,algo_1)
|
||||
##print ret
|
||||
##ret=mesh.AddHypothesis(shell,hypo1)
|
||||
##print ret
|
||||
##ret=gen.Compute(mesh,ids)
|
||||
##print ret
|
1068
src/StdMeshers/StdMeshers_Hexa_3D.cxx
Normal file
1068
src/StdMeshers/StdMeshers_Hexa_3D.cxx
Normal file
File diff suppressed because it is too large
Load Diff
872
src/StdMeshers/StdMeshers_MEFISTO_2D.cxx
Normal file
872
src/StdMeshers/StdMeshers_MEFISTO_2D.cxx
Normal file
@ -0,0 +1,872 @@
|
||||
// SMESH SMESH : implementaion of SMESH idl descriptions
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_MEFISTO_2D.cxx
|
||||
// Moved here from SMESH_MEFISTO_2D.cxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
#include "StdMeshers_MEFISTO_2D.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_subMesh.hxx"
|
||||
|
||||
#include "StdMeshers_MaxElementArea.hxx"
|
||||
#include "StdMeshers_LengthFromEdges.hxx"
|
||||
|
||||
#include "Rn.h"
|
||||
#include "aptrte.h"
|
||||
|
||||
#include "SMDS_MeshElement.hxx"
|
||||
#include "SMDS_MeshNode.hxx"
|
||||
#include "SMDS_EdgePosition.hxx"
|
||||
#include "SMDS_FacePosition.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <GCPnts_AbscissaPoint.hxx>
|
||||
#include <GCPnts_UniformAbscissa.hxx>
|
||||
#include <TColStd_ListIteratorOfListOfInteger.hxx>
|
||||
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
|
||||
#include <string>
|
||||
//#include <algorithm>
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D(int hypId, int studyId,
|
||||
SMESH_Gen * gen):SMESH_2D_Algo(hypId, studyId, gen)
|
||||
{
|
||||
MESSAGE("StdMeshers_MEFISTO_2D::StdMeshers_MEFISTO_2D");
|
||||
_name = "MEFISTO_2D";
|
||||
// _shapeType = TopAbs_FACE;
|
||||
_shapeType = (1 << TopAbs_FACE);
|
||||
_compatibleHypothesis.push_back("MaxElementArea");
|
||||
_compatibleHypothesis.push_back("LengthFromEdges");
|
||||
|
||||
_edgeLength = 0;
|
||||
_maxElementArea = 0;
|
||||
_hypMaxElementArea = NULL;
|
||||
_hypLengthFromEdges = NULL;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_MEFISTO_2D::~StdMeshers_MEFISTO_2D()
|
||||
{
|
||||
MESSAGE("StdMeshers_MEFISTO_2D::~StdMeshers_MEFISTO_2D");
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
bool StdMeshers_MEFISTO_2D::CheckHypothesis
|
||||
(SMESH_Mesh& aMesh,
|
||||
const TopoDS_Shape& aShape,
|
||||
SMESH_Hypothesis::Hypothesis_Status& aStatus)
|
||||
{
|
||||
//MESSAGE("StdMeshers_MEFISTO_2D::CheckHypothesis");
|
||||
|
||||
_hypMaxElementArea = NULL;
|
||||
_hypLengthFromEdges = NULL;
|
||||
|
||||
list <const SMESHDS_Hypothesis * >::const_iterator itl;
|
||||
const SMESHDS_Hypothesis *theHyp;
|
||||
|
||||
const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
|
||||
int nbHyp = hyps.size();
|
||||
if (!nbHyp)
|
||||
{
|
||||
aStatus = SMESH_Hypothesis::HYP_MISSING;
|
||||
return false; // can't work with no hypothesis
|
||||
}
|
||||
|
||||
itl = hyps.begin();
|
||||
theHyp = (*itl); // use only the first hypothesis
|
||||
|
||||
string hypName = theHyp->GetName();
|
||||
//int hypId = theHyp->GetID();
|
||||
//SCRUTE(hypName);
|
||||
|
||||
bool isOk = false;
|
||||
|
||||
if (hypName == "MaxElementArea")
|
||||
{
|
||||
_hypMaxElementArea = static_cast<const StdMeshers_MaxElementArea *>(theHyp);
|
||||
ASSERT(_hypMaxElementArea);
|
||||
_maxElementArea = _hypMaxElementArea->GetMaxArea();
|
||||
_edgeLength = 0;
|
||||
isOk = true;
|
||||
aStatus = SMESH_Hypothesis::HYP_OK;
|
||||
}
|
||||
|
||||
else if (hypName == "LengthFromEdges")
|
||||
{
|
||||
_hypLengthFromEdges = static_cast<const StdMeshers_LengthFromEdges *>(theHyp);
|
||||
ASSERT(_hypLengthFromEdges);
|
||||
_edgeLength = 0;
|
||||
_maxElementArea = 0;
|
||||
isOk = true;
|
||||
aStatus = SMESH_Hypothesis::HYP_OK;
|
||||
}
|
||||
else
|
||||
aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE;
|
||||
|
||||
if (isOk)
|
||||
{
|
||||
isOk = false;
|
||||
if (_maxElementArea > 0)
|
||||
{
|
||||
// _edgeLength = 2 * sqrt(_maxElementArea); // triangles : minorant
|
||||
_edgeLength = 2 * sqrt(_maxElementArea/sqrt(3.0));
|
||||
isOk = true;
|
||||
}
|
||||
else
|
||||
isOk = (_hypLengthFromEdges != NULL); // **** check mode
|
||||
if (!isOk)
|
||||
aStatus = SMESH_Hypothesis::HYP_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
//SCRUTE(_edgeLength);
|
||||
//SCRUTE(_maxElementArea);
|
||||
return isOk;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
bool StdMeshers_MEFISTO_2D::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
|
||||
{
|
||||
MESSAGE("StdMeshers_MEFISTO_2D::Compute");
|
||||
|
||||
if (_hypLengthFromEdges)
|
||||
_edgeLength = ComputeEdgeElementLength(aMesh, aShape);
|
||||
|
||||
bool isOk = false;
|
||||
//const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
||||
//SMESH_subMesh *theSubMesh = aMesh.GetSubMesh(aShape);
|
||||
|
||||
const TopoDS_Face & FF = TopoDS::Face(aShape);
|
||||
bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
|
||||
TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
|
||||
|
||||
Z nblf; //nombre de lignes fermees (enveloppe en tete)
|
||||
Z *nudslf = NULL; //numero du dernier sommet de chaque ligne fermee
|
||||
R2 *uvslf = NULL;
|
||||
Z nbpti = 0; //nombre points internes futurs sommets de la triangulation
|
||||
R2 *uvpti = NULL;
|
||||
|
||||
Z nbst;
|
||||
R2 *uvst = NULL;
|
||||
Z nbt;
|
||||
Z *nust = NULL;
|
||||
Z ierr = 0;
|
||||
|
||||
Z nutysu = 1; // 1: il existe un fonction areteideale_()
|
||||
// Z nutysu=0; // 0: on utilise aretmx
|
||||
R aretmx = _edgeLength; // longueur max aretes future triangulation
|
||||
|
||||
nblf = NumberOfWires(F);
|
||||
|
||||
nudslf = new Z[1 + nblf];
|
||||
nudslf[0] = 0;
|
||||
int iw = 1;
|
||||
int nbpnt = 0;
|
||||
|
||||
myOuterWire = BRepTools::OuterWire(F);
|
||||
nbpnt += NumberOfPoints(aMesh, myOuterWire);
|
||||
if ( nbpnt < 3 ) // ex: a circle with 2 segments
|
||||
return false;
|
||||
nudslf[iw++] = nbpnt;
|
||||
|
||||
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
|
||||
if (!myOuterWire.IsSame(W))
|
||||
{
|
||||
nbpnt += NumberOfPoints(aMesh, W);
|
||||
nudslf[iw++] = nbpnt;
|
||||
}
|
||||
}
|
||||
|
||||
// avoid passing same uv points for a vertex common to 2 wires
|
||||
TopTools_IndexedDataMapOfShapeListOfShape VWMap;
|
||||
if ( iw - 1 > 1 ) // nbofWires > 1
|
||||
TopExp::MapShapesAndAncestors( F , TopAbs_VERTEX, TopAbs_WIRE, VWMap );
|
||||
|
||||
uvslf = new R2[nudslf[nblf]];
|
||||
int m = 0;
|
||||
|
||||
double scalex, scaley;
|
||||
ComputeScaleOnFace(aMesh, F, scalex, scaley);
|
||||
|
||||
map<int, const SMDS_MeshNode*> mefistoToDS; // correspondence mefisto index--> points IDNodes
|
||||
if ( !LoadPoints(aMesh, F, myOuterWire, uvslf, m,
|
||||
mefistoToDS, scalex, scaley, VWMap))
|
||||
return false;
|
||||
|
||||
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
|
||||
if (!myOuterWire.IsSame(W))
|
||||
{
|
||||
if (! LoadPoints(aMesh, F, W, uvslf, m,
|
||||
mefistoToDS, scalex, scaley, VWMap ))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uvst = NULL;
|
||||
nust = NULL;
|
||||
aptrte(nutysu, aretmx,
|
||||
nblf, nudslf, uvslf, nbpti, uvpti, nbst, uvst, nbt, nust, ierr);
|
||||
|
||||
if (ierr == 0)
|
||||
{
|
||||
MESSAGE("... End Triangulation Generated Triangle Number " << nbt);
|
||||
MESSAGE(" Node Number " << nbst);
|
||||
StoreResult(aMesh, nbst, uvst, nbt, nust, F,
|
||||
faceIsForward, mefistoToDS, scalex, scaley);
|
||||
isOk = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
MESSAGE("Error in Triangulation");
|
||||
isOk = false;
|
||||
}
|
||||
if (nudslf != NULL)
|
||||
delete[]nudslf;
|
||||
if (uvslf != NULL)
|
||||
delete[]uvslf;
|
||||
if (uvst != NULL)
|
||||
delete[]uvst;
|
||||
if (nust != NULL)
|
||||
delete[]nust;
|
||||
return isOk;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : fixOverlappedLinkUV
|
||||
//purpose : prevent failure due to overlapped adjacent links
|
||||
//=======================================================================
|
||||
|
||||
static bool fixOverlappedLinkUV( R2& uv0, const R2& uv1, const R2& uv2 )
|
||||
{
|
||||
gp_XY v1( uv0.x - uv1.x, uv0.y - uv1.y );
|
||||
gp_XY v2( uv2.x - uv1.x, uv2.y - uv1.y );
|
||||
|
||||
double tol2 = DBL_MIN * DBL_MIN;
|
||||
double sqMod1 = v1.SquareModulus();
|
||||
if ( sqMod1 <= tol2 ) return false;
|
||||
double sqMod2 = v2.SquareModulus();
|
||||
if ( sqMod2 <= tol2 ) return false;
|
||||
|
||||
double dot = v1*v2;
|
||||
|
||||
// check sinus >= 1.e-3
|
||||
const double minSin = 1.e-3;
|
||||
if ( dot > 0 && 1 - dot * dot / ( sqMod1 * sqMod2 ) < minSin * minSin ) {
|
||||
MESSAGE(" ___ FIX UV ____" << uv0.x << " " << uv0.y);
|
||||
v1.SetCoord( -v1.Y(), v1.X() );
|
||||
double delta = sqrt( sqMod1 ) * minSin;
|
||||
if ( v1.X() < 0 )
|
||||
uv0.x -= delta;
|
||||
else
|
||||
uv0.x += delta;
|
||||
if ( v1.Y() < 0 )
|
||||
uv0.y -= delta;
|
||||
else
|
||||
uv0.y += delta;
|
||||
// MESSAGE(" -> " << uv0.x << " " << uv0.y << " ");
|
||||
// MESSAGE("v1( " << v1.X() << " " << v1.Y() << " ) " <<
|
||||
// "v2( " << v2.X() << " " << v2.Y() << " ) ");
|
||||
// MESSAGE("SIN: " << sqrt(1 - dot * dot / (sqMod1 * sqMod2)));
|
||||
// v1.SetCoord( uv0.x - uv1.x, uv0.y - uv1.y );
|
||||
// v2.SetCoord( uv2.x - uv1.x, uv2.y - uv1.y );
|
||||
// gp_XY v3( uv2.x - uv0.x, uv2.y - uv0.y );
|
||||
// sqMod1 = v1.SquareModulus();
|
||||
// sqMod2 = v2.SquareModulus();
|
||||
// dot = v1*v2;
|
||||
// double sin = sqrt(1 - dot * dot / (sqMod1 * sqMod2));
|
||||
// MESSAGE("NEW SIN: " << sin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : fixCommonVertexUV
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static bool fixCommonVertexUV (gp_Pnt2d & theUV,
|
||||
const TopoDS_Vertex& theV,
|
||||
const TopoDS_Wire& theW,
|
||||
const TopoDS_Wire& theOW,
|
||||
const TopoDS_Face& theF,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape & theVWMap,
|
||||
SMESH_Mesh & theMesh)
|
||||
{
|
||||
if( theW.IsSame( theOW ) ||
|
||||
!theVWMap.Contains( theV )) return false;
|
||||
|
||||
// check if there is another wire sharing theV
|
||||
const TopTools_ListOfShape& WList = theVWMap.FindFromKey( theV );
|
||||
TopTools_ListIteratorOfListOfShape aWIt;
|
||||
for ( aWIt.Initialize( WList ); aWIt.More(); aWIt.Next() )
|
||||
if ( !theW.IsSame( aWIt.Value() ))
|
||||
break;
|
||||
if ( !aWIt.More() ) return false;
|
||||
|
||||
TopTools_ListOfShape EList;
|
||||
list< double > UList;
|
||||
|
||||
// find edges of theW sharing theV
|
||||
// and find 2d normal to them at theV
|
||||
gp_Vec2d N(0.,0.);
|
||||
TopoDS_Iterator itE( theW );
|
||||
for ( ; itE.More(); itE.Next() )
|
||||
{
|
||||
const TopoDS_Edge& E = TopoDS::Edge( itE.Value() );
|
||||
TopoDS_Iterator itV( E );
|
||||
for ( ; itV.More(); itV.Next() )
|
||||
{
|
||||
const TopoDS_Vertex & V = TopoDS::Vertex( itV.Value() );
|
||||
if ( !V.IsSame( theV ))
|
||||
continue;
|
||||
EList.Append( E );
|
||||
Standard_Real u = BRep_Tool::Parameter( V, E );
|
||||
UList.push_back( u );
|
||||
double f, l;
|
||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, theF, f, l);
|
||||
gp_Vec2d d1;
|
||||
gp_Pnt2d p;
|
||||
C2d->D1( u, p, d1 );
|
||||
gp_Vec2d n( d1.Y(), -d1.X() );
|
||||
if ( E.Orientation() == TopAbs_REVERSED )
|
||||
n.Reverse();
|
||||
N += n.Normalized();
|
||||
}
|
||||
}
|
||||
|
||||
// define step size by which to move theUV
|
||||
|
||||
gp_Pnt2d nextUV; // uv of next node on edge, most distant of the four
|
||||
double maxDist = -DBL_MAX;
|
||||
TopTools_ListIteratorOfListOfShape aEIt (EList);
|
||||
list< double >::iterator aUIt = UList.begin();
|
||||
for ( ; aEIt.More(); aEIt.Next(), aUIt++ )
|
||||
{
|
||||
const TopoDS_Edge& E = TopoDS::Edge( aEIt.Value() );
|
||||
double f, l;
|
||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, theF, f, l);
|
||||
|
||||
double umin = DBL_MAX, umax = -DBL_MAX;
|
||||
SMDS_NodeIteratorPtr nIt = theMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
|
||||
if ( !nIt->more() ) // no nodes on edge, only on vertices
|
||||
{
|
||||
umin = l;
|
||||
umax = f;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ( nIt->more() ) {
|
||||
const SMDS_MeshNode* node = nIt->next();
|
||||
const SMDS_EdgePosition* epos =
|
||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||
double u = epos->GetUParameter();
|
||||
if ( u < umin )
|
||||
umin = u;
|
||||
if ( u > umax )
|
||||
umax = u;
|
||||
}
|
||||
}
|
||||
bool isFirstCommon = ( *aUIt == f );
|
||||
gp_Pnt2d uv = C2d->Value( isFirstCommon ? umin : umax );
|
||||
double dist = theUV.SquareDistance( uv );
|
||||
if ( dist > maxDist ) {
|
||||
maxDist = dist;
|
||||
nextUV = uv;
|
||||
}
|
||||
}
|
||||
R2 uv0, uv1, uv2;
|
||||
uv0.x = theUV.X(); uv0.y = theUV.Y();
|
||||
uv1.x = nextUV.X(); uv1.y = nextUV.Y();
|
||||
uv2.x = uv0.x; uv2.y = uv0.y;
|
||||
if ( fixOverlappedLinkUV( uv0, uv1, uv2 ))
|
||||
{
|
||||
double step = theUV.Distance( gp_Pnt2d( uv0.x, uv0.y ));
|
||||
|
||||
// move theUV along the normal by the step
|
||||
|
||||
N *= step;
|
||||
|
||||
MESSAGE("--fixCommonVertexUV move(" << theUV.X() << " " << theUV.Y()
|
||||
<< ") by (" << N.X() << " " << N.Y() << ")"
|
||||
<< endl << "--- MAX DIST " << maxDist);
|
||||
|
||||
theUV.SetXY( theUV.XY() + N.XY() );
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
bool StdMeshers_MEFISTO_2D::LoadPoints(SMESH_Mesh & aMesh,
|
||||
const TopoDS_Face & FF,
|
||||
const TopoDS_Wire & WW,
|
||||
R2 * uvslf,
|
||||
int & m,
|
||||
map<int, const SMDS_MeshNode*>&mefistoToDS,
|
||||
double scalex,
|
||||
double scaley,
|
||||
const TopTools_IndexedDataMapOfShapeListOfShape& VWMap)
|
||||
{
|
||||
// MESSAGE("StdMeshers_MEFISTO_2D::LoadPoints");
|
||||
|
||||
//SMDS_Mesh * meshDS = aMesh.GetMeshDS();
|
||||
|
||||
TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
|
||||
|
||||
int mInit = m, mFirst, iEdge;
|
||||
gp_XY scale( scalex, scaley );
|
||||
|
||||
TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD));
|
||||
BRepTools_WireExplorer wexp(W, F);
|
||||
for (wexp.Init(W, F), iEdge = 0; wexp.More(); wexp.Next(), iEdge++)
|
||||
{
|
||||
const TopoDS_Edge & E = wexp.Current();
|
||||
|
||||
// --- IDNodes of first and last Vertex
|
||||
|
||||
TopoDS_Vertex VFirst, VLast;
|
||||
TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l
|
||||
|
||||
ASSERT(!VFirst.IsNull());
|
||||
SMDS_NodeIteratorPtr lid=
|
||||
aMesh.GetSubMesh(VFirst)->GetSubMeshDS()->GetNodes();
|
||||
if ( !lid->more() ) {
|
||||
MESSAGE (" NO NODE BUILT ON VERTEX ");
|
||||
return false;
|
||||
}
|
||||
const SMDS_MeshNode* idFirst = lid->next();
|
||||
|
||||
ASSERT(!VLast.IsNull());
|
||||
lid=aMesh.GetSubMesh(VLast)->GetSubMeshDS()->GetNodes();
|
||||
if ( !lid->more() ) {
|
||||
MESSAGE (" NO NODE BUILT ON VERTEX ");
|
||||
return false;
|
||||
}
|
||||
const SMDS_MeshNode* idLast = lid->next();
|
||||
|
||||
// --- edge internal IDNodes (relies on good order storage, not checked)
|
||||
|
||||
int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||
|
||||
double f, l;
|
||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
|
||||
|
||||
SMDS_NodeIteratorPtr ite= aMesh.GetSubMesh(E)->GetSubMeshDS()->GetNodes();
|
||||
|
||||
//bool isForward = (E.Orientation() == TopAbs_FORWARD);
|
||||
map<double, const SMDS_MeshNode*> params;
|
||||
|
||||
while(ite->more())
|
||||
{
|
||||
const SMDS_MeshNode * node = ite->next();
|
||||
const SMDS_EdgePosition* epos =
|
||||
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
|
||||
double param = epos->GetUParameter();
|
||||
params[param] = node;
|
||||
}
|
||||
if ( nbPoints != params.size())
|
||||
{
|
||||
MESSAGE( "BAD NODE ON EDGE POSITIONS" );
|
||||
return false;
|
||||
}
|
||||
|
||||
mFirst = m;
|
||||
|
||||
// --- load 2D values into MEFISTO structure,
|
||||
// add IDNodes in mefistoToDS map
|
||||
if (E.Orientation() == TopAbs_FORWARD)
|
||||
{
|
||||
gp_Pnt2d p = C2d->Value(f).XY().Multiplied( scale ); // first point = Vertex Forward
|
||||
if ( fixCommonVertexUV( p, VFirst, W, myOuterWire, F, VWMap, aMesh ))
|
||||
myNodesOnCommonV.push_back( idFirst );
|
||||
uvslf[m].x = p.X();
|
||||
uvslf[m].y = p.Y();
|
||||
mefistoToDS[m + 1] = idFirst;
|
||||
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
//MESSAGE("__ f "<<f<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
m++;
|
||||
map<double, const SMDS_MeshNode*>::iterator itp = params.begin();
|
||||
for (int i = 1; i <= nbPoints; i++) // nbPoints internal
|
||||
{
|
||||
double param = (*itp).first;
|
||||
gp_Pnt2d p = C2d->Value(param).XY().Multiplied( scale );
|
||||
uvslf[m].x = p.X();
|
||||
uvslf[m].y = p.Y();
|
||||
mefistoToDS[m + 1] = (*itp).second;
|
||||
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
//MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
m++;
|
||||
itp++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gp_Pnt2d p = C2d->Value(l).XY().Multiplied( scale ); // last point = Vertex Reversed
|
||||
if ( fixCommonVertexUV( p, VLast, W, myOuterWire, F, VWMap, aMesh ))
|
||||
myNodesOnCommonV.push_back( idLast );
|
||||
uvslf[m].x = p.X();
|
||||
uvslf[m].y = p.Y();
|
||||
mefistoToDS[m + 1] = idLast;
|
||||
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
//MESSAGE("__ l "<<l<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
m++;
|
||||
map<double, const SMDS_MeshNode*>::reverse_iterator itp = params.rbegin();
|
||||
for (int i = nbPoints; i >= 1; i--)
|
||||
{
|
||||
double param = (*itp).first;
|
||||
gp_Pnt2d p = C2d->Value(param).XY().Multiplied( scale );
|
||||
uvslf[m].x = p.X();
|
||||
uvslf[m].y = p.Y();
|
||||
mefistoToDS[m + 1] = (*itp).second;
|
||||
//MESSAGE(" "<<m<<" "<<mefistoToDS[m+1]);
|
||||
//MESSAGE("__ "<<i<<" "<<param<<" "<<uvslf[m].x <<" "<<uvslf[m].y);
|
||||
m++;
|
||||
itp++;
|
||||
}
|
||||
}
|
||||
// prevent failure on overlapped adjacent links
|
||||
if ( iEdge > 0 )
|
||||
fixOverlappedLinkUV (uvslf[ mFirst - 1],
|
||||
uvslf[ mFirst ],
|
||||
uvslf[ mFirst + 1 ]);
|
||||
|
||||
} // for wexp
|
||||
|
||||
fixOverlappedLinkUV (uvslf[ m - 1],
|
||||
uvslf[ mInit ],
|
||||
uvslf[ mInit + 1 ]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_MEFISTO_2D::ComputeScaleOnFace(SMESH_Mesh & aMesh,
|
||||
const TopoDS_Face & aFace, double &scalex, double &scaley)
|
||||
{
|
||||
//MESSAGE("StdMeshers_MEFISTO_2D::ComputeScaleOnFace");
|
||||
TopoDS_Face F = TopoDS::Face(aFace.Oriented(TopAbs_FORWARD));
|
||||
TopoDS_Wire W = BRepTools::OuterWire(F);
|
||||
|
||||
double xmin = 1.e300; // min & max of face 2D parametric coord.
|
||||
double xmax = -1.e300;
|
||||
double ymin = 1.e300;
|
||||
double ymax = -1.e300;
|
||||
int nbp = 23;
|
||||
scalex = 1;
|
||||
scaley = 1;
|
||||
|
||||
TopExp_Explorer wexp(W, TopAbs_EDGE);
|
||||
for ( ; wexp.More(); wexp.Next())
|
||||
{
|
||||
const TopoDS_Edge & E = TopoDS::Edge( wexp.Current() );
|
||||
double f, l;
|
||||
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E, F, f, l);
|
||||
if ( C2d.IsNull() ) continue;
|
||||
double du = (l - f) / double (nbp);
|
||||
for (int i = 0; i <= nbp; i++)
|
||||
{
|
||||
double param = f + double (i) * du;
|
||||
gp_Pnt2d p = C2d->Value(param);
|
||||
if (p.X() < xmin)
|
||||
xmin = p.X();
|
||||
if (p.X() > xmax)
|
||||
xmax = p.X();
|
||||
if (p.Y() < ymin)
|
||||
ymin = p.Y();
|
||||
if (p.Y() > ymax)
|
||||
ymax = p.Y();
|
||||
// MESSAGE(" "<< f<<" "<<l<<" "<<param<<" "<<xmin<<" "<<xmax<<" "<<ymin<<" "<<ymax);
|
||||
}
|
||||
}
|
||||
// SCRUTE(xmin);
|
||||
// SCRUTE(xmax);
|
||||
// SCRUTE(ymin);
|
||||
// SCRUTE(ymax);
|
||||
double xmoy = (xmax + xmin) / 2.;
|
||||
double ymoy = (ymax + ymin) / 2.;
|
||||
double xsize = xmax - xmin;
|
||||
double ysize = ymax - ymin;
|
||||
|
||||
Handle(Geom_Surface) S = BRep_Tool::Surface(F); // 3D surface
|
||||
|
||||
double length_x = 0;
|
||||
double length_y = 0;
|
||||
gp_Pnt PX0 = S->Value(xmin, ymoy);
|
||||
gp_Pnt PY0 = S->Value(xmoy, ymin);
|
||||
double dx = xsize / double (nbp);
|
||||
double dy = ysize / double (nbp);
|
||||
for (int i = 1; i <= nbp; i++)
|
||||
{
|
||||
double x = xmin + double (i) * dx;
|
||||
gp_Pnt PX = S->Value(x, ymoy);
|
||||
double y = ymin + double (i) * dy;
|
||||
gp_Pnt PY = S->Value(xmoy, y);
|
||||
length_x += PX.Distance(PX0);
|
||||
length_y += PY.Distance(PY0);
|
||||
PX0 = PX;
|
||||
PY0 = PY;
|
||||
}
|
||||
scalex = length_x / xsize;
|
||||
scaley = length_y / ysize;
|
||||
// SCRUTE(xsize);
|
||||
// SCRUTE(ysize);
|
||||
double xyratio = xsize*scalex/(ysize*scaley);
|
||||
const double maxratio = 1.e2;
|
||||
//SCRUTE(xyratio);
|
||||
if (xyratio > maxratio) {
|
||||
SCRUTE( scaley );
|
||||
scaley *= xyratio / maxratio;
|
||||
SCRUTE( scaley );
|
||||
}
|
||||
else if (xyratio < 1./maxratio) {
|
||||
SCRUTE( scalex );
|
||||
scalex *= 1 / xyratio / maxratio;
|
||||
SCRUTE( scalex );
|
||||
}
|
||||
ASSERT(scalex);
|
||||
ASSERT(scaley);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_MEFISTO_2D::StoreResult(SMESH_Mesh & aMesh,
|
||||
Z nbst, R2 * uvst, Z nbt, Z * nust,
|
||||
const TopoDS_Face & F, bool faceIsForward,
|
||||
map<int, const SMDS_MeshNode*>&mefistoToDS,
|
||||
double scalex, double scaley)
|
||||
{
|
||||
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
|
||||
int faceID = meshDS->ShapeToIndex( F );
|
||||
|
||||
Z n, m;
|
||||
Handle(Geom_Surface) S = BRep_Tool::Surface(F);
|
||||
|
||||
for (n = 0; n < nbst; n++)
|
||||
{
|
||||
if (mefistoToDS.find(n + 1) == mefistoToDS.end())
|
||||
{
|
||||
double u = uvst[n][0] / scalex;
|
||||
double v = uvst[n][1] / scaley;
|
||||
gp_Pnt P = S->Value(u, v);
|
||||
|
||||
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
||||
meshDS->SetNodeOnFace(node, faceID, u, v);
|
||||
|
||||
//MESSAGE(P.X()<<" "<<P.Y()<<" "<<P.Z());
|
||||
mefistoToDS[n + 1] = node;
|
||||
//MESSAGE("NEW: "<<n<<" "<<mefistoToDS[n+1]);
|
||||
}
|
||||
}
|
||||
|
||||
m = 0;
|
||||
//int mt = 0;
|
||||
|
||||
//SCRUTE(faceIsForward);
|
||||
for (n = 1; n <= nbt; n++)
|
||||
{
|
||||
int inode1 = nust[m++];
|
||||
int inode2 = nust[m++];
|
||||
int inode3 = nust[m++];
|
||||
|
||||
const SMDS_MeshNode *n1, *n2, *n3;
|
||||
n1 = mefistoToDS[inode1];
|
||||
n2 = mefistoToDS[inode2];
|
||||
n3 = mefistoToDS[inode3];
|
||||
//MESSAGE("-- "<<inode1<<" "<<inode2<<" "<<inode3);
|
||||
|
||||
// triangle points must be in trigonometric order if face is Forward
|
||||
// else they must be put clockwise
|
||||
|
||||
bool triangleIsWellOriented = faceIsForward;
|
||||
|
||||
SMDS_MeshElement * elt;
|
||||
if (triangleIsWellOriented)
|
||||
elt = meshDS->AddFace(n1, n2, n3);
|
||||
else
|
||||
elt = meshDS->AddFace(n1, n3, n2);
|
||||
|
||||
meshDS->SetMeshElementOnShape(elt, faceID);
|
||||
m++;
|
||||
}
|
||||
|
||||
// remove bad elements build on vertices shared by wires
|
||||
|
||||
list<const SMDS_MeshNode*>::iterator itN = myNodesOnCommonV.begin();
|
||||
for ( ; itN != myNodesOnCommonV.end(); itN++ )
|
||||
{
|
||||
const SMDS_MeshNode* node = *itN;
|
||||
SMDS_ElemIteratorPtr invElemIt = node->GetInverseElementIterator();
|
||||
while ( invElemIt->more() )
|
||||
{
|
||||
const SMDS_MeshElement* elem = invElemIt->next();
|
||||
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
|
||||
int nbSame = 0;
|
||||
while ( itN->more() )
|
||||
if ( itN->next() == node)
|
||||
nbSame++;
|
||||
if (nbSame > 1) {
|
||||
MESSAGE( "RM bad element " << elem->GetID());
|
||||
meshDS->RemoveElement( elem );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
double StdMeshers_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh & aMesh,
|
||||
const TopoDS_Shape & aShape)
|
||||
{
|
||||
//MESSAGE("StdMeshers_MEFISTO_2D::ComputeEdgeElementLength");
|
||||
// **** a mettre dans SMESH_2D_Algo ?
|
||||
|
||||
const TopoDS_Face & FF = TopoDS::Face(aShape);
|
||||
//bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD);
|
||||
TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD));
|
||||
|
||||
double meanElementLength = 100;
|
||||
double wireLength = 0;
|
||||
int wireElementsNumber = 0;
|
||||
for (TopExp_Explorer exp(F, TopAbs_WIRE); exp.More(); exp.Next())
|
||||
{
|
||||
const TopoDS_Wire & W = TopoDS::Wire(exp.Current());
|
||||
for (TopExp_Explorer expe(W, TopAbs_EDGE); expe.More(); expe.Next())
|
||||
{
|
||||
const TopoDS_Edge & E = TopoDS::Edge(expe.Current());
|
||||
int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes();
|
||||
double length = EdgeLength(E);
|
||||
wireLength += length;
|
||||
wireElementsNumber += nb;
|
||||
}
|
||||
}
|
||||
if (wireElementsNumber)
|
||||
meanElementLength = wireLength / wireElementsNumber;
|
||||
//SCRUTE(meanElementLength);
|
||||
return meanElementLength;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
ostream & StdMeshers_MEFISTO_2D::SaveTo(ostream & save)
|
||||
{
|
||||
return save;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
istream & StdMeshers_MEFISTO_2D::LoadFrom(istream & load)
|
||||
{
|
||||
return load;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
ostream & operator <<(ostream & save, StdMeshers_MEFISTO_2D & hyp)
|
||||
{
|
||||
return hyp.SaveTo( save );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
istream & operator >>(istream & load, StdMeshers_MEFISTO_2D & hyp)
|
||||
{
|
||||
return hyp.LoadFrom( load );
|
||||
}
|
1582
src/StdMeshers/StdMeshers_Penta_3D.cxx
Normal file
1582
src/StdMeshers/StdMeshers_Penta_3D.cxx
Normal file
File diff suppressed because it is too large
Load Diff
66
src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx
Normal file
66
src/StdMeshers_I/StdMeshers_Arithmetic1D_i.hxx
Normal file
@ -0,0 +1,66 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_Arithmetic1D_i.hxx
|
||||
// Author : Damien COQUERET, OCC
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_ARITHMETIC1D_I_HXX_
|
||||
#define _SMESH_ARITHMETIC1D_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_Arithmetic1D.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Arithmetic 1D hypothesis
|
||||
// ======================================================
|
||||
class StdMeshers_Arithmetic1D_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_Arithmetic1D,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_Arithmetic1D_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
// Destructor
|
||||
virtual ~StdMeshers_Arithmetic1D_i();
|
||||
|
||||
// Set length
|
||||
void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
// Get length
|
||||
CORBA::Double GetLength(CORBA::Boolean theIsStart);
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_Arithmetic1D* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
70
src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx
Normal file
70
src/StdMeshers_I/StdMeshers_Deflection1D_i.hxx
Normal file
@ -0,0 +1,70 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_Deflection1D_i.hxx
|
||||
// Moved here from SMESH_LocalLength_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_Deflection1D_I_HXX_
|
||||
#define _SMESH_Deflection1D_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_Deflection1D.hxx"
|
||||
|
||||
class SMESH_Gen;
|
||||
|
||||
// ======================================================
|
||||
// Local Length hypothesis
|
||||
// ======================================================
|
||||
class StdMeshers_Deflection1D_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_Deflection1D,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_Deflection1D_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
// Destructor
|
||||
virtual ~StdMeshers_Deflection1D_i();
|
||||
|
||||
// Set deflection
|
||||
void SetDeflection( CORBA::Double theLength )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
// Get deflection
|
||||
CORBA::Double GetDeflection();
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_Deflection1D* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
135
src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx
Normal file
135
src/StdMeshers_I/StdMeshers_LengthFromEdges_i.cxx
Normal file
@ -0,0 +1,135 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_LengthFromEdges_i.cxx
|
||||
// Moved here from SMESH_LengthFromEdges_i.cxx
|
||||
// Author : Nadir BOUHAMOU CEA/DEN, Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
#include "StdMeshers_LengthFromEdges_i.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
|
||||
#include "Utils_CorbaException.hxx"
|
||||
#include "utilities.h"
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_LengthFromEdges_i::StdMeshers_LengthFromEdges_i
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_LengthFromEdges_i::StdMeshers_LengthFromEdges_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA )
|
||||
{
|
||||
MESSAGE( "StdMeshers_LengthFromEdges_i::StdMeshers_LengthFromEdges_i" );
|
||||
myBaseImpl = new ::StdMeshers_LengthFromEdges( theGenImpl->GetANewId(),
|
||||
theStudyId,
|
||||
theGenImpl );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_LengthFromEdges_i::~StdMeshers_LengthFromEdges_i
|
||||
*
|
||||
* Destructor
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_LengthFromEdges_i::~StdMeshers_LengthFromEdges_i()
|
||||
{
|
||||
MESSAGE( "StdMeshers_LengthFromEdges_i::~StdMeshers_LengthFromEdges_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_LengthFromEdges_i::SetMode
|
||||
*
|
||||
* Set mode
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void StdMeshers_LengthFromEdges_i::SetMode( CORBA::Long theMode )
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
MESSAGE( "StdMeshers_LengthFromEdges_i::SetMode" );
|
||||
ASSERT( myBaseImpl );
|
||||
try {
|
||||
this->GetImpl()->SetMode( theMode );
|
||||
}
|
||||
catch ( SALOME_Exception& S_ex ) {
|
||||
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
|
||||
SALOME::BAD_PARAM );
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_LengthFromEdges_i::GetMode
|
||||
*
|
||||
* Get mode
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
CORBA::Long StdMeshers_LengthFromEdges_i::GetMode()
|
||||
{
|
||||
MESSAGE( "StdMeshers_LengthFromEdges_i::GetMode" );
|
||||
ASSERT( myBaseImpl );
|
||||
return this->GetImpl()->GetMode();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_LengthFromEdges_i::GetImpl
|
||||
*
|
||||
* Get implementation
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
::StdMeshers_LengthFromEdges* StdMeshers_LengthFromEdges_i::GetImpl()
|
||||
{
|
||||
MESSAGE( "StdMeshers_LengthFromEdges_i::GetImpl" );
|
||||
return ( ::StdMeshers_LengthFromEdges* )myBaseImpl;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether hypothesis supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
CORBA::Boolean StdMeshers_LengthFromEdges_i::IsDimSupported( SMESH::Dimension type )
|
||||
{
|
||||
return type == SMESH::DIM_2D;
|
||||
}
|
||||
|
68
src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx
Normal file
68
src/StdMeshers_I/StdMeshers_LengthFromEdges_i.hxx
Normal file
@ -0,0 +1,68 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_LengthFromEdges_i.hxx
|
||||
// Moved here from SMESH_LengthFromEdges_i.hxx
|
||||
// Author : Nadir BOUHAMOU CEA/DEN, Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_LENGTHFROMEDGES_I_HXX_
|
||||
#define _SMESH_LENGTHFROMEDGES_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_LengthFromEdges.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Length from edges hypothesis
|
||||
// ======================================================
|
||||
class StdMeshers_LengthFromEdges_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_LengthFromEdges,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_LengthFromEdges_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
// Destructor
|
||||
virtual ~StdMeshers_LengthFromEdges_i();
|
||||
|
||||
// Set mode
|
||||
void SetMode( CORBA::Long theMode )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
// Get mode
|
||||
CORBA::Long GetMode();
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_LengthFromEdges* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
70
src/StdMeshers_I/StdMeshers_LocalLength_i.hxx
Normal file
70
src/StdMeshers_I/StdMeshers_LocalLength_i.hxx
Normal file
@ -0,0 +1,70 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_LocalLength_i.hxx
|
||||
// Moved here from SMESH_LocalLength_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_LOCALLENGTH_I_HXX_
|
||||
#define _SMESH_LOCALLENGTH_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_LocalLength.hxx"
|
||||
|
||||
class SMESH_Gen;
|
||||
|
||||
// ======================================================
|
||||
// Local Length hypothesis
|
||||
// ======================================================
|
||||
class StdMeshers_LocalLength_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_LocalLength,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_LocalLength_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
// Destructor
|
||||
virtual ~StdMeshers_LocalLength_i();
|
||||
|
||||
// Set length
|
||||
void SetLength( CORBA::Double theLength )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
// Get length
|
||||
CORBA::Double GetLength();
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_LocalLength* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
67
src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx
Normal file
67
src/StdMeshers_I/StdMeshers_MaxElementArea_i.hxx
Normal file
@ -0,0 +1,67 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_MaxElementArea_i.hxx
|
||||
// Moved here from SMESH_MaxElementArea_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_MAXELEMENTAREA_I_HXX_
|
||||
#define _SMESH_MAXELEMENTAREA_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_MaxElementArea.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Maximum Element Area hypothesis
|
||||
// ======================================================
|
||||
class StdMeshers_MaxElementArea_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_MaxElementArea,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_MaxElementArea_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
// Destructor
|
||||
virtual ~StdMeshers_MaxElementArea_i();
|
||||
|
||||
// Set maximum element area
|
||||
void SetMaxElementArea( CORBA::Double theArea )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
// Get maximum element area
|
||||
CORBA::Double GetMaxElementArea();
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_MaxElementArea* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
67
src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx
Normal file
67
src/StdMeshers_I/StdMeshers_MaxElementVolume_i.hxx
Normal file
@ -0,0 +1,67 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_MaxElementVolume_i.hxx
|
||||
// Moved here from SMESH_MaxElementVolume_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_MAXELEMENTVOLUME_I_HXX_
|
||||
#define _SMESH_MAXELEMENTVOLUME_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_MaxElementVolume.hxx"
|
||||
|
||||
// ======================================================
|
||||
// Maximum Element Volume hypothesis
|
||||
// ======================================================
|
||||
class StdMeshers_MaxElementVolume_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_MaxElementVolume,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_MaxElementVolume_i( PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
// Destructor
|
||||
virtual ~StdMeshers_MaxElementVolume_i();
|
||||
|
||||
// Set maximum element volume
|
||||
void SetMaxElementVolume( CORBA::Double theVolume )
|
||||
throw (SALOME::SALOME_Exception);
|
||||
// Get maximum element volume
|
||||
CORBA::Double GetMaxElementVolume();
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_MaxElementVolume* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
81
src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx
Normal file
81
src/StdMeshers_I/StdMeshers_NotConformAllowed_i.cxx
Normal file
@ -0,0 +1,81 @@
|
||||
// SMESH StdMeshers_I : idl implementation based on 'SMESH' unit's classes
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_NotConformAllowed_i.cxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
#include "StdMeshers_NotConformAllowed_i.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
|
||||
#include "utilities.h"
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* Constructor:
|
||||
* _name is related to the class name: prefix = SMESH_ ; suffix = _i .
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_NotConformAllowed_i::StdMeshers_NotConformAllowed_i
|
||||
(PortableServer::POA_ptr thePOA,
|
||||
int studyId,
|
||||
::SMESH_Gen* genImpl)
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA )
|
||||
{
|
||||
MESSAGE("StdMeshers_NotConformAllowed_i::StdMeshers_NotConformAllowed_i");
|
||||
myBaseImpl = new ::StdMeshers_NotConformAllowed(genImpl->GetANewId(),
|
||||
studyId,
|
||||
genImpl);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
*
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
StdMeshers_NotConformAllowed_i::~StdMeshers_NotConformAllowed_i()
|
||||
{
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether hypothesis supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
CORBA::Boolean StdMeshers_NotConformAllowed_i::IsDimSupported( SMESH::Dimension /*type*/ )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
57
src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx
Normal file
57
src/StdMeshers_I/StdMeshers_NotConformAllowed_i.hxx
Normal file
@ -0,0 +1,57 @@
|
||||
// SMESH StdMeshers_I : idl implementation based on 'SMESH' unit's classes
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_NotConformAllowed_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _StdMeshers_NotConformAllowed_I_HXX_
|
||||
#define _StdMeshers_NotConformAllowed_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
|
||||
#include "StdMeshers_NotConformAllowed.hxx"
|
||||
|
||||
class StdMeshers_NotConformAllowed_i:
|
||||
public POA_StdMeshers::StdMeshers_NotConformAllowed,
|
||||
public SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
StdMeshers_NotConformAllowed_i(PortableServer::POA_ptr thePOA,
|
||||
int studyId,
|
||||
::SMESH_Gen* genImpl);
|
||||
virtual ~StdMeshers_NotConformAllowed_i();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
|
||||
protected:
|
||||
::StdMeshers_NotConformAllowed* _impl;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
91
src/StdMeshers_I/StdMeshers_Propagation_i.cxx
Normal file
91
src/StdMeshers_I/StdMeshers_Propagation_i.cxx
Normal file
@ -0,0 +1,91 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 CEA
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_Propagation_i.cxx
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
#include "StdMeshers_Propagation_i.hxx"
|
||||
#include "SMESH_Gen.hxx"
|
||||
|
||||
#include "Utils_CorbaException.hxx"
|
||||
#include "utilities.h"
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Propagation_i::StdMeshers_Propagation_i
|
||||
*
|
||||
* Constructor
|
||||
*/
|
||||
//=============================================================================
|
||||
StdMeshers_Propagation_i::StdMeshers_Propagation_i (PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl )
|
||||
: SALOME::GenericObj_i( thePOA ),
|
||||
SMESH_Hypothesis_i( thePOA )
|
||||
{
|
||||
MESSAGE( "StdMeshers_Propagation_i::StdMeshers_Propagation_i" );
|
||||
myBaseImpl = new ::StdMeshers_Propagation(theGenImpl->GetANewId(),
|
||||
theStudyId,
|
||||
theGenImpl);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Propagation_i::~StdMeshers_Propagation_i
|
||||
*
|
||||
* Destructor
|
||||
*/
|
||||
//=============================================================================
|
||||
StdMeshers_Propagation_i::~StdMeshers_Propagation_i()
|
||||
{
|
||||
MESSAGE( "StdMeshers_Propagation_i::~StdMeshers_Propagation_i" );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* StdMeshers_Propagation_i::GetImpl
|
||||
*
|
||||
* Get implementation
|
||||
*/
|
||||
//=============================================================================
|
||||
::StdMeshers_Propagation* StdMeshers_Propagation_i::GetImpl()
|
||||
{
|
||||
MESSAGE( "StdMeshers_Propagation_i::GetImpl" );
|
||||
return ( ::StdMeshers_Propagation* )myBaseImpl;
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Verify whether hypothesis supports given entity type
|
||||
* \param type - dimension (see SMESH::Dimension enumeration)
|
||||
* \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
|
||||
*
|
||||
* Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
|
||||
*/
|
||||
//================================================================================
|
||||
CORBA::Boolean StdMeshers_Propagation_i::IsDimSupported( SMESH::Dimension type )
|
||||
{
|
||||
return type == SMESH::DIM_1D;
|
||||
}
|
||||
|
60
src/StdMeshers_I/StdMeshers_Propagation_i.hxx
Normal file
60
src/StdMeshers_I/StdMeshers_Propagation_i.hxx
Normal file
@ -0,0 +1,60 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 CEA
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_Propagation_i.hxx
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_PROPAGATION_I_HXX_
|
||||
#define _SMESH_PROPAGATION_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_Propagation.hxx"
|
||||
|
||||
class SMESH_Gen;
|
||||
|
||||
// ======================================================
|
||||
// Propagation hypothesis
|
||||
// ======================================================
|
||||
class StdMeshers_Propagation_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_Propagation,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_Propagation_i (PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl);
|
||||
// Destructor
|
||||
virtual ~StdMeshers_Propagation_i();
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_Propagation* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
70
src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx
Normal file
70
src/StdMeshers_I/StdMeshers_StartEndLength_i.hxx
Normal file
@ -0,0 +1,70 @@
|
||||
// SMESH SMESH_I : idl implementation based on 'SMESH' unit's calsses
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : StdMeshers_StartEndLength_i.hxx
|
||||
// Moved here from SMESH_LocalLength_i.hxx
|
||||
// Author : Paul RASCLE, EDF
|
||||
// Module : SMESH
|
||||
// $Header$
|
||||
|
||||
#ifndef _SMESH_StartEndLength_I_HXX_
|
||||
#define _SMESH_StartEndLength_I_HXX_
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
|
||||
|
||||
#include "SMESH_Hypothesis_i.hxx"
|
||||
#include "StdMeshers_StartEndLength.hxx"
|
||||
|
||||
class SMESH_Gen;
|
||||
|
||||
// ======================================================
|
||||
// Local Length hypothesis
|
||||
// ======================================================
|
||||
class StdMeshers_StartEndLength_i:
|
||||
public virtual POA_StdMeshers::StdMeshers_StartEndLength,
|
||||
public virtual SMESH_Hypothesis_i
|
||||
{
|
||||
public:
|
||||
// Constructor
|
||||
StdMeshers_StartEndLength_i(PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
::SMESH_Gen* theGenImpl );
|
||||
// Destructor
|
||||
virtual ~StdMeshers_StartEndLength_i();
|
||||
|
||||
// Set length
|
||||
void SetLength( CORBA::Double theLength, CORBA::Boolean theIsStart )
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
// Get length
|
||||
CORBA::Double GetLength(CORBA::Boolean theIsStart);
|
||||
|
||||
// Get implementation
|
||||
::StdMeshers_StartEndLength* GetImpl();
|
||||
|
||||
// Verify whether hypothesis supports given entity type
|
||||
CORBA::Boolean IsDimSupported( SMESH::Dimension type );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user