mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-31 03:40:33 +05:00
PR: debug autotests in progress, still 87 bugs
This commit is contained in:
parent
53a9669e91
commit
56c2e29961
@ -223,11 +223,11 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
|
|||||||
if ( anElem->IsQuadratic() ) {
|
if ( anElem->IsQuadratic() ) {
|
||||||
switch ( anElem->GetType() ) {
|
switch ( anElem->GetType() ) {
|
||||||
case SMDSAbs_Edge:
|
case SMDSAbs_Edge:
|
||||||
anIter = static_cast<const SMDS_QuadraticEdge*>
|
anIter = dynamic_cast<const SMDS_VtkEdge*>
|
||||||
(anElem)->interlacedNodesElemIterator();
|
(anElem)->interlacedNodesElemIterator();
|
||||||
break;
|
break;
|
||||||
case SMDSAbs_Face:
|
case SMDSAbs_Face:
|
||||||
anIter = static_cast<const SMDS_QuadraticFaceOfNodes*>
|
anIter = dynamic_cast<const SMDS_VtkFace*>
|
||||||
(anElem)->interlacedNodesElemIterator();
|
(anElem)->interlacedNodesElemIterator();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1247,10 +1247,10 @@ void Length2D::GetValues(TValues& theValues){
|
|||||||
const SMDS_MeshFace* anElem = anIter->next();
|
const SMDS_MeshFace* anElem = anIter->next();
|
||||||
|
|
||||||
if(anElem->IsQuadratic()) {
|
if(anElem->IsQuadratic()) {
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_VtkFace* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(anElem);
|
dynamic_cast<const SMDS_VtkFace*>(anElem);
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
|
||||||
long aNodeId[4];
|
long aNodeId[4];
|
||||||
gp_Pnt P[4];
|
gp_Pnt P[4];
|
||||||
|
|
||||||
@ -1444,7 +1444,7 @@ void MultiConnection2D::GetValues(MValues& theValues){
|
|||||||
const SMDS_MeshFace* anElem = anIter->next();
|
const SMDS_MeshFace* anElem = anIter->next();
|
||||||
SMDS_ElemIteratorPtr aNodesIter;
|
SMDS_ElemIteratorPtr aNodesIter;
|
||||||
if ( anElem->IsQuadratic() )
|
if ( anElem->IsQuadratic() )
|
||||||
aNodesIter = static_cast<const SMDS_QuadraticFaceOfNodes*>
|
aNodesIter = dynamic_cast<const SMDS_VtkFace*>
|
||||||
(anElem)->interlacedNodesElemIterator();
|
(anElem)->interlacedNodesElemIterator();
|
||||||
else
|
else
|
||||||
aNodesIter = anElem->nodesIterator();
|
aNodesIter = anElem->nodesIterator();
|
||||||
@ -1603,7 +1603,7 @@ bool FreeEdges::IsSatisfy( long theId )
|
|||||||
|
|
||||||
SMDS_ElemIteratorPtr anIter;
|
SMDS_ElemIteratorPtr anIter;
|
||||||
if ( aFace->IsQuadratic() ) {
|
if ( aFace->IsQuadratic() ) {
|
||||||
anIter = static_cast<const SMDS_QuadraticFaceOfNodes*>
|
anIter = dynamic_cast<const SMDS_VtkFace*>
|
||||||
(aFace)->interlacedNodesElemIterator();
|
(aFace)->interlacedNodesElemIterator();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1672,7 +1672,7 @@ void FreeEdges::GetBoreders(TBorders& theBorders)
|
|||||||
long anElemId = anElem->GetID();
|
long anElemId = anElem->GetID();
|
||||||
SMDS_ElemIteratorPtr aNodesIter;
|
SMDS_ElemIteratorPtr aNodesIter;
|
||||||
if ( anElem->IsQuadratic() )
|
if ( anElem->IsQuadratic() )
|
||||||
aNodesIter = static_cast<const SMDS_QuadraticFaceOfNodes*>(anElem)->
|
aNodesIter = static_cast<const SMDS_VtkFace*>(anElem)->
|
||||||
interlacedNodesElemIterator();
|
interlacedNodesElemIterator();
|
||||||
else
|
else
|
||||||
aNodesIter = anElem->nodesIterator();
|
aNodesIter = anElem->nodesIterator();
|
||||||
|
@ -274,21 +274,35 @@ DriverMED_R_SMESHDS_Mesh
|
|||||||
typedef MED::TVector<int> TQuantities;
|
typedef MED::TVector<int> TQuantities;
|
||||||
TQuantities aQuantities(aNbFaces);
|
TQuantities aQuantities(aNbFaces);
|
||||||
TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem);
|
TInt aNbNodes = aPolyedreInfo->GetNbNodes(iElem);
|
||||||
|
//MESSAGE("--- aNbNodes " << aNbNodes);
|
||||||
TNodeIds aNodeIds(aNbNodes);
|
TNodeIds aNodeIds(aNbNodes);
|
||||||
for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){
|
for(TInt iFace = 0, iNode = 0; iFace < aNbFaces; iFace++){
|
||||||
|
//MESSAGE("--- iface " << aNbFaces << " " << iFace);
|
||||||
MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
|
MED::TCConnSlice aConnSlice = aConnSliceArr[iFace];
|
||||||
TInt aNbConn = aConnSlice.size();
|
TInt aNbConn = aConnSlice.size();
|
||||||
aQuantities[iFace] = aNbConn;
|
aQuantities[iFace] = aNbConn;
|
||||||
#ifdef _EDF_NODE_IDS_
|
#ifdef _EDF_NODE_IDS_
|
||||||
|
//MESSAGE(anIsNodeNum);
|
||||||
if(anIsNodeNum)
|
if(anIsNodeNum)
|
||||||
for(TInt iConn = 0; iConn < aNbConn; iConn++)
|
for(TInt iConn = 0; iConn < aNbConn; iConn++)
|
||||||
aNodeIds[iNode++] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
|
{
|
||||||
|
//MESSAGE("iConn " << iConn << " aConnSlice[iConn] " << aConnSlice[iConn]);
|
||||||
|
aNodeIds[iNode] = aNodeInfo->GetElemNum(aConnSlice[iConn] - 1);
|
||||||
|
//MESSAGE("aNodeIds[" << iNode << "]=" << aNodeIds[iNode]);
|
||||||
|
iNode++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
for(TInt iConn = 0; iConn < aNbConn; iConn++)
|
for(TInt iConn = 0; iConn < aNbConn; iConn++)
|
||||||
|
{
|
||||||
|
//MESSAGE("iConn " << iConn);
|
||||||
aNodeIds[iNode++] = aConnSlice[iConn];
|
aNodeIds[iNode++] = aConnSlice[iConn];
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
for(TInt iConn = 0; iConn < aNbConn; iConn++)
|
for(TInt iConn = 0; iConn < aNbConn; iConn++)
|
||||||
|
{
|
||||||
|
//MESSAGE("iConn " << iConn);
|
||||||
aNodeIds[iNode++] = aConnSlice[iConn];
|
aNodeIds[iNode++] = aConnSlice[iConn];
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -707,7 +721,7 @@ DriverMED_R_SMESHDS_Mesh
|
|||||||
// }
|
// }
|
||||||
#ifndef _DEXCEPT_
|
#ifndef _DEXCEPT_
|
||||||
}catch(const std::exception& exc){
|
}catch(const std::exception& exc){
|
||||||
INFOS("Following exception was caught:\n\t"<<exc.what());
|
INFOS("The following exception was caught:\n\t"<<exc.what());
|
||||||
aResult = DRS_FAIL;
|
aResult = DRS_FAIL;
|
||||||
}catch(...){
|
}catch(...){
|
||||||
INFOS("Unknown exception was caught !!!");
|
INFOS("Unknown exception was caught !!!");
|
||||||
@ -738,7 +752,7 @@ DriverMED_R_SMESHDS_Mesh
|
|||||||
}
|
}
|
||||||
#ifndef _DEXCEPT_
|
#ifndef _DEXCEPT_
|
||||||
}catch(const std::exception& exc){
|
}catch(const std::exception& exc){
|
||||||
INFOS("Follow exception was caught:\n\t"<<exc.what());
|
INFOS("The following exception was caught:\n\t"<<exc.what());
|
||||||
aResult = DRS_FAIL;
|
aResult = DRS_FAIL;
|
||||||
}catch(...){
|
}catch(...){
|
||||||
INFOS("Unknown exception was caught !!!");
|
INFOS("Unknown exception was caught !!!");
|
||||||
@ -769,7 +783,7 @@ list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(const std::exception& exc){
|
}catch(const std::exception& exc){
|
||||||
INFOS("Follow exception was caught:\n\t"<<exc.what());
|
INFOS("Following exception was caught:\n\t"<<exc.what());
|
||||||
theStatus = DRS_FAIL;
|
theStatus = DRS_FAIL;
|
||||||
}catch(...){
|
}catch(...){
|
||||||
INFOS("Unknown exception was caught !!!");
|
INFOS("Unknown exception was caught !!!");
|
||||||
|
@ -622,6 +622,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
|||||||
nbElemInfo.NbHexas( ORDER_QUADRATIC ),
|
nbElemInfo.NbHexas( ORDER_QUADRATIC ),
|
||||||
SMDSAbs_Volume));
|
SMDSAbs_Volume));
|
||||||
if ( polyTypesSupported ) {
|
if ( polyTypesSupported ) {
|
||||||
|
//MESSAGE("polyTypesSupported");
|
||||||
aTElemTypeDatas.push_back( TElemTypeData(anEntity,
|
aTElemTypeDatas.push_back( TElemTypeData(anEntity,
|
||||||
ePOLYEDRE,
|
ePOLYEDRE,
|
||||||
nbElemInfo.NbPolyhedrons(),
|
nbElemInfo.NbPolyhedrons(),
|
||||||
@ -738,18 +739,21 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
|||||||
// ----------------
|
// ----------------
|
||||||
else if (aElemTypeData->_geomType == ePOLYEDRE )
|
else if (aElemTypeData->_geomType == ePOLYEDRE )
|
||||||
{
|
{
|
||||||
|
//MESSAGE("_geomType == ePOLYEDRE");
|
||||||
if ( nbPolyhedronNodes == 0 ) {
|
if ( nbPolyhedronNodes == 0 ) {
|
||||||
// Count nb of nodes
|
// Count nb of nodes
|
||||||
while ( const SMDS_MeshElement* anElem = elemIterator->next() ) {
|
while ( const SMDS_MeshElement* anElem = elemIterator->next() ) {
|
||||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
const SMDS_VtkVolume *aPolyedre = dynamic_cast<const SMDS_VtkVolume*>(anElem);
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( anElem );
|
if ( aPolyedre && aPolyedre->IsPoly()) {
|
||||||
if ( aPolyedre ) {
|
|
||||||
nbPolyhedronNodes += aPolyedre->NbNodes();
|
nbPolyhedronNodes += aPolyedre->NbNodes();
|
||||||
nbPolyhedronFaces += aPolyedre->NbFaces();
|
nbPolyhedronFaces += aPolyedre->NbFaces();
|
||||||
if ( ++iElem == aElemTypeData->_nbElems )
|
if ( ++iElem == aElemTypeData->_nbElems )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//MESSAGE("nbPolyhedronNodes=" << nbPolyhedronNodes);
|
||||||
|
//MESSAGE("nbPolyhedronFaces=" << nbPolyhedronFaces);
|
||||||
|
//MESSAGE("_nbElems="<< aElemTypeData->_nbElems);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Store in med file
|
// Store in med file
|
||||||
@ -771,19 +775,22 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
|||||||
TInt iFace = 0, iNode = 0;
|
TInt iFace = 0, iNode = 0;
|
||||||
while ( const SMDS_MeshElement* anElem = elemIterator->next() )
|
while ( const SMDS_MeshElement* anElem = elemIterator->next() )
|
||||||
{
|
{
|
||||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
const SMDS_VtkVolume *aPolyedre = dynamic_cast<const SMDS_VtkVolume*>(anElem);
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( anElem );
|
|
||||||
if ( !aPolyedre )
|
if ( !aPolyedre )
|
||||||
continue;
|
continue;
|
||||||
|
if ( !aPolyedre->IsPoly() )
|
||||||
|
continue;
|
||||||
|
//MESSAGE("index[" << iElem << "]=" << index[iElem] << " iElem=" << iElem);
|
||||||
// index
|
// index
|
||||||
TInt aNbFaces = aPolyedre->NbFaces();
|
TInt aNbFaces = aPolyedre->NbFaces();
|
||||||
index[ iElem+1 ] = index[ iElem ] + aNbFaces;
|
index[ iElem+1 ] = index[ iElem ] + aNbFaces;
|
||||||
|
//MESSAGE("index[" << iElem+1 << "]=" << index[iElem+1] << " iElem=" << iElem);
|
||||||
|
|
||||||
// face index
|
// face index
|
||||||
for (TInt f = 1; f <= aNbFaces; ++f, ++iFace ) {
|
for (TInt f = 1; f <= aNbFaces; ++f, ++iFace ) {
|
||||||
int aNbFaceNodes = aPolyedre->NbFaceNodes( f );
|
int aNbFaceNodes = aPolyedre->NbFaceNodes( f );
|
||||||
faces[ iFace+1 ] = faces[ iFace ] + aNbFaceNodes;
|
faces[ iFace+1 ] = faces[ iFace ] + aNbFaceNodes;
|
||||||
|
//MESSAGE("faces[" << iFace+1 << "]=" << faces[iFace+1] << " iFace=" << iFace);
|
||||||
}
|
}
|
||||||
// connectivity
|
// connectivity
|
||||||
SMDS_ElemIteratorPtr nodeIt = anElem->nodesIterator();
|
SMDS_ElemIteratorPtr nodeIt = anElem->nodesIterator();
|
||||||
@ -791,8 +798,10 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
|||||||
const SMDS_MeshElement* aNode = nodeIt->next();
|
const SMDS_MeshElement* aNode = nodeIt->next();
|
||||||
#ifdef _EDF_NODE_IDS_
|
#ifdef _EDF_NODE_IDS_
|
||||||
conn[ iNode ] = aNodeIdMap[aNode->GetID()];
|
conn[ iNode ] = aNodeIdMap[aNode->GetID()];
|
||||||
|
//MESSAGE("conn["<< iNode << "]=" << conn[iNode] << " aNode->GetID()=" << aNode->GetID());
|
||||||
#else
|
#else
|
||||||
conn[ iNode ] = aNode->GetID();
|
conn[ iNode ] = aNode->GetID();
|
||||||
|
//MESSAGE("conn["<< iNode << "]=" << conn[iNode]);
|
||||||
#endif
|
#endif
|
||||||
++iNode;
|
++iNode;
|
||||||
}
|
}
|
||||||
@ -868,11 +877,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch(const std::exception& exc) {
|
catch(const std::exception& exc) {
|
||||||
INFOS("Follow exception was cought:\n\t"<<exc.what());
|
INFOS("The following exception was caught:\n\t"<<exc.what());
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
INFOS("Unknown exception was cought !!!");
|
INFOS("Unknown exception was caught !!!");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +163,8 @@ Driver_Mesh::Status DriverUNV_W_SMDS_Mesh::Perform()
|
|||||||
aNodesIter = anElem->nodesIteratorToUNV();
|
aNodesIter = anElem->nodesIteratorToUNV();
|
||||||
if ( anElem->IsPoly() ) {
|
if ( anElem->IsPoly() ) {
|
||||||
MESSAGE("anElem->IsPoly");
|
MESSAGE("anElem->IsPoly");
|
||||||
if ( const SMDS_PolyhedralVolumeOfNodes* ph =
|
if ( const SMDS_VtkVolume* ph =
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
|
dynamic_cast<const SMDS_VtkVolume*> (anElem))
|
||||||
{
|
{
|
||||||
aNbNodes = ph->NbUniqueNodes();
|
aNbNodes = ph->NbUniqueNodes();
|
||||||
aNodesIter = ph->uniqueNodesIterator();
|
aNodesIter = ph->uniqueNodesIterator();
|
||||||
|
@ -416,8 +416,8 @@ void SMESH_VisualObjDef::buildElemPrs()
|
|||||||
// Convertions connectivities from SMDS to VTK
|
// Convertions connectivities from SMDS to VTK
|
||||||
if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
|
if (anElem->IsPoly() && aNbNodes > 3) { // POLYEDRE
|
||||||
|
|
||||||
if ( const SMDS_PolyhedralVolumeOfNodes* ph =
|
if ( const SMDS_VtkVolume* ph =
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem))
|
dynamic_cast<const SMDS_VtkVolume*> (anElem))
|
||||||
{
|
{
|
||||||
aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
|
aNbNodes = GetConnect(ph->uniqueNodesIterator(),aConnect);
|
||||||
anIdList->SetNumberOfIds( aNbNodes );
|
anIdList->SetNumberOfIds( aNbNodes );
|
||||||
|
@ -1608,7 +1608,7 @@ bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SMDS_PolyhedralVolumeOfNodes* vol = dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>(elem);
|
const SMDS_VtkVolume* vol = dynamic_cast<const SMDS_VtkVolume*>(elem);
|
||||||
if (!vol) {
|
if (!vol) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1621,7 +1621,9 @@ bool SMDS_Mesh::ChangePolyhedronNodes (const SMDS_MeshElement * elem,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// change nodes
|
// change nodes
|
||||||
bool Ok = const_cast<SMDS_PolyhedralVolumeOfNodes*>(vol)->ChangeNodes(nodes, quantities);
|
// TODO remove this function
|
||||||
|
//bool Ok = const_cast<SMDS_VtkVolume*>(vol)->ChangeNodes(nodes, quantities);
|
||||||
|
bool Ok = false;
|
||||||
if (!Ok) {
|
if (!Ok) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -175,6 +175,13 @@ SMDS_ElemIteratorPtr SMDS_MeshElement::nodesIteratorToUNV() const
|
|||||||
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! virtual, redefined in vtkEdge, vtkFace and vtkVolume classes
|
||||||
|
SMDS_ElemIteratorPtr SMDS_MeshElement::interlacedNodesElemIterator() const
|
||||||
|
{
|
||||||
|
MESSAGE("Iterator not implemented");
|
||||||
|
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
///Return the ID of the element
|
///Return the ID of the element
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -65,6 +65,7 @@ public:
|
|||||||
SMDS_ElemIteratorPtr facesIterator() const;
|
SMDS_ElemIteratorPtr facesIterator() const;
|
||||||
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
||||||
|
virtual SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
|
||||||
|
|
||||||
// std-like iteration on nodes
|
// std-like iteration on nodes
|
||||||
typedef SMDS_StdIterator< const SMDS_MeshNode*, SMDS_ElemIteratorPtr > iterator;
|
typedef SMDS_StdIterator< const SMDS_MeshNode*, SMDS_ElemIteratorPtr > iterator;
|
||||||
|
@ -221,7 +221,8 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
|||||||
holes = 0;
|
holes = 0;
|
||||||
compactState = lookHoleStart;
|
compactState = lookHoleStart;
|
||||||
|
|
||||||
vtkIdType tmpid[50];
|
// TODO some polyhedron may be huge (only in some tests)
|
||||||
|
vtkIdType tmpid[NBMAXNODESINCELL];
|
||||||
vtkIdType *pointsCell = &tmpid[0]; // --- points id to fill a new cell
|
vtkIdType *pointsCell = &tmpid[0]; // --- points id to fill a new cell
|
||||||
|
|
||||||
for (int i = 0; i < oldCellSize; i++)
|
for (int i = 0; i < oldCellSize; i++)
|
||||||
@ -341,6 +342,7 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes, std::vector
|
|||||||
vtkIdType nbpts;
|
vtkIdType nbpts;
|
||||||
vtkIdType *oldPtsCell = 0;
|
vtkIdType *oldPtsCell = 0;
|
||||||
this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
|
this->Connectivity->GetCell(oldLoc, nbpts, oldPtsCell);
|
||||||
|
assert(nbpts < NBMAXNODESINCELL);
|
||||||
//MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
|
//MESSAGE(j << " " << alreadyCopied << " " << (int)this->Types->GetValue(j) << " " << oldLoc << " " << nbpts );
|
||||||
for (int l = 0; l < nbpts; l++)
|
for (int l = 0; l < nbpts; l++)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,9 @@
|
|||||||
|
|
||||||
#define NBMAXNEIGHBORS 10
|
#define NBMAXNEIGHBORS 10
|
||||||
|
|
||||||
|
// allow very huge polyhedrons in tests
|
||||||
|
#define NBMAXNODESINCELL 5000
|
||||||
|
|
||||||
class SMDS_Downward;
|
class SMDS_Downward;
|
||||||
class SMDS_Mesh;
|
class SMDS_Mesh;
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
#include "SMDS_MeshElement.hxx"
|
#include "SMDS_MeshElement.hxx"
|
||||||
#include "SMDS_MeshNode.hxx"
|
#include "SMDS_MeshNode.hxx"
|
||||||
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
#include "SMDS_VtkVolume.hxx"
|
||||||
#include "SMDS_Mesh.hxx"
|
#include "SMDS_Mesh.hxx"
|
||||||
|
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
@ -499,7 +499,7 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (myVolume->IsPoly()) {
|
if (myVolume->IsPoly()) {
|
||||||
myPolyedre = static_cast<const SMDS_PolyhedralVolumeOfNodes*>( myVolume );
|
myPolyedre = dynamic_cast<const SMDS_VtkVolume*>( myVolume );
|
||||||
if (!myPolyedre) {
|
if (!myPolyedre) {
|
||||||
MESSAGE("Warning: bad volumic element");
|
MESSAGE("Warning: bad volumic element");
|
||||||
return false;
|
return false;
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
class SMDS_MeshElement;
|
class SMDS_MeshElement;
|
||||||
class SMDS_MeshNode;
|
class SMDS_MeshNode;
|
||||||
class SMDS_PolyhedralVolumeOfNodes;
|
class SMDS_VtkVolume;
|
||||||
class SMDS_MeshVolume;
|
class SMDS_MeshVolume;
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -205,7 +205,7 @@ private:
|
|||||||
bool setFace( int faceIndex );
|
bool setFace( int faceIndex );
|
||||||
|
|
||||||
const SMDS_MeshElement* myVolume;
|
const SMDS_MeshElement* myVolume;
|
||||||
const SMDS_PolyhedralVolumeOfNodes* myPolyedre;
|
const SMDS_VtkVolume* myPolyedre;
|
||||||
|
|
||||||
bool myVolForward;
|
bool myVolForward;
|
||||||
int myNbFaces;
|
int myNbFaces;
|
||||||
|
@ -70,10 +70,8 @@ SMDS_VtkCellIterator::SMDS_VtkCellIterator(SMDS_Mesh* mesh, int vtkCellId, SMDSA
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSEntity_Polyhedra:
|
case SMDSEntity_Polyhedra:
|
||||||
{
|
MESSAGE("SMDS_VtkCellIterator Polyhedra (iterate on actual nodes)");
|
||||||
MESSAGE("SMDS_VtkCellIterator Polyhedra");
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -95,16 +93,14 @@ const SMDS_MeshElement* SMDS_VtkCellIterator::next()
|
|||||||
return _mesh->FindNode(id);
|
return _mesh->FindNode(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh,
|
SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType) :
|
||||||
int vtkCellId,
|
SMDS_VtkCellIterator()
|
||||||
SMDSAbs_EntityType aType)
|
|
||||||
: SMDS_VtkCellIterator()
|
|
||||||
{
|
{
|
||||||
_mesh = mesh;
|
_mesh = mesh;
|
||||||
_cellId = vtkCellId;
|
_cellId = vtkCellId;
|
||||||
_index = 0;
|
_index = 0;
|
||||||
_type = aType;
|
_type = aType;
|
||||||
//MESSAGE("SMDS_VtkCellInterlacedIterator " << _type);
|
//MESSAGE("SMDS_VtkCellInterlacedIterator (UNV)" << _type);
|
||||||
|
|
||||||
_vtkIdList = vtkIdList::New();
|
_vtkIdList = vtkIdList::New();
|
||||||
vtkIdType* pts;
|
vtkIdType* pts;
|
||||||
@ -116,49 +112,49 @@ SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh,
|
|||||||
{
|
{
|
||||||
case SMDSEntity_Quad_Edge:
|
case SMDSEntity_Quad_Edge:
|
||||||
{
|
{
|
||||||
static int id[] = {0,2,1};
|
static int id[] = { 0, 2, 1 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSEntity_Quad_Triangle:
|
case SMDSEntity_Quad_Triangle:
|
||||||
{
|
{
|
||||||
static int id[] = {0,3,1,4,2,5};
|
static int id[] = { 0, 3, 1, 4, 2, 5 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSEntity_Quad_Quadrangle:
|
case SMDSEntity_Quad_Quadrangle:
|
||||||
{
|
{
|
||||||
static int id[] = {0,4,1,5,2,6,3,7};
|
static int id[] = { 0, 4, 1, 5, 2, 6, 3, 7 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSEntity_Quad_Tetra:
|
case SMDSEntity_Quad_Tetra:
|
||||||
{
|
{
|
||||||
static int id[] = {0,4,1,5,2,6,7,8,9,3};
|
static int id[] = { 0, 4, 1, 5, 2, 6, 7, 8, 9, 3 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSEntity_Quad_Pyramid:
|
case SMDSEntity_Quad_Pyramid:
|
||||||
{
|
{
|
||||||
static int id[] = {0,5,1,6,2,7,3,8,9,10,11,12,4};
|
static int id[] = { 0, 5, 1, 6, 2, 7, 3, 8, 9, 10, 11, 12, 4 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSEntity_Penta:
|
case SMDSEntity_Penta:
|
||||||
{
|
{
|
||||||
static int id[] = {0,2,1,3,5,4};
|
static int id[] = { 0, 2, 1, 3, 5, 4 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSEntity_Quad_Penta:
|
case SMDSEntity_Quad_Penta:
|
||||||
{
|
{
|
||||||
static int id[] = {0,8,2,7,1,6,12,14,13,3,11,5,10,4,9};
|
static int id[] = { 0, 8, 2, 7, 1, 6, 12, 14, 13, 3, 11, 5, 10, 4, 9 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SMDSEntity_Quad_Hexa:
|
case SMDSEntity_Quad_Hexa:
|
||||||
{
|
{
|
||||||
static int id[] = {0,8,1,9,2,10,3,11,16,17,18,19,4,12,5,13,6,14,7,15};
|
static int id[] = { 0, 8, 1, 9, 2, 10, 3, 11, 16, 17, 18, 19, 4, 12, 5, 13, 6, 14, 7, 15 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -168,13 +164,14 @@ SMDS_VtkCellIteratorToUNV::SMDS_VtkCellIteratorToUNV(SMDS_Mesh* mesh,
|
|||||||
case SMDSEntity_Quad_Polyhedra:
|
case SMDSEntity_Quad_Polyhedra:
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
static int id[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29};
|
static int id[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||||
|
25, 26, 27, 28, 29 };
|
||||||
ids = id;
|
ids = id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//MESSAGE("_nbNodes " << _nbNodes);
|
//MESSAGE("_nbNodes " << _nbNodes);
|
||||||
for (int i=0; i<_nbNodes; i++)
|
for (int i = 0; i < _nbNodes; i++)
|
||||||
_vtkIdList->SetId(i, pts[ids[i]]);
|
_vtkIdList->SetId(i, pts[ids[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,3 +179,56 @@ SMDS_VtkCellIteratorToUNV::~SMDS_VtkCellIteratorToUNV()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMDS_VtkCellIteratorPolyH::SMDS_VtkCellIteratorPolyH(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType) :
|
||||||
|
SMDS_VtkCellIterator()
|
||||||
|
{
|
||||||
|
_mesh = mesh;
|
||||||
|
_cellId = vtkCellId;
|
||||||
|
_index = 0;
|
||||||
|
_type = aType;
|
||||||
|
//MESSAGE("SMDS_VtkCellIteratorPolyH " << _type);
|
||||||
|
_vtkIdList = vtkIdList::New();
|
||||||
|
vtkUnstructuredGrid* grid = _mesh->getGrid();
|
||||||
|
grid->GetCellPoints(_cellId, _vtkIdList);
|
||||||
|
_nbNodes = _vtkIdList->GetNumberOfIds();
|
||||||
|
switch (_type)
|
||||||
|
{
|
||||||
|
case SMDSEntity_Polyhedra:
|
||||||
|
{
|
||||||
|
//MESSAGE("SMDS_VtkCellIterator Polyhedra");
|
||||||
|
vtkIdType nFaces = 0;
|
||||||
|
vtkIdType* ptIds = 0;
|
||||||
|
grid->GetFaceStream(_cellId, nFaces, ptIds);
|
||||||
|
int id = 0;
|
||||||
|
_nbNodesInFaces = 0;
|
||||||
|
for (int i = 0; i < nFaces; i++)
|
||||||
|
{
|
||||||
|
int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
|
||||||
|
_nbNodesInFaces += nodesInFace;
|
||||||
|
id += (nodesInFace + 1);
|
||||||
|
}
|
||||||
|
_vtkIdList->SetNumberOfIds(_nbNodesInFaces);
|
||||||
|
id = 0;
|
||||||
|
int n = 0;
|
||||||
|
for (int i = 0; i < nFaces; i++)
|
||||||
|
{
|
||||||
|
int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
|
||||||
|
for (int k = 1; k <= nodesInFace; k++)
|
||||||
|
_vtkIdList->SetId(n++, ptIds[id + k]);
|
||||||
|
id += (nodesInFace + 1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SMDS_VtkCellIteratorPolyH::~SMDS_VtkCellIteratorPolyH()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SMDS_VtkCellIteratorPolyH::more()
|
||||||
|
{
|
||||||
|
return (_index < _nbNodesInFaces);
|
||||||
|
}
|
||||||
|
@ -40,4 +40,14 @@ public:
|
|||||||
virtual ~SMDS_VtkCellIteratorToUNV();
|
virtual ~SMDS_VtkCellIteratorToUNV();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SMDS_VtkCellIteratorPolyH: public SMDS_VtkCellIterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SMDS_VtkCellIteratorPolyH(SMDS_Mesh* mesh, int vtkCellId, SMDSAbs_EntityType aType);
|
||||||
|
virtual ~SMDS_VtkCellIteratorPolyH();
|
||||||
|
virtual bool more();
|
||||||
|
protected:
|
||||||
|
int _nbNodesInFaces;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,3 +139,8 @@ SMDS_ElemIteratorPtr SMDS_VtkEdge::nodesIteratorToUNV() const
|
|||||||
{
|
{
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_VtkEdge::interlacedNodesElemIterator() const
|
||||||
|
{
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
|
}
|
||||||
|
@ -28,8 +28,9 @@ public:
|
|||||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||||
virtual bool IsQuadratic() const;
|
virtual bool IsQuadratic() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
||||||
|
virtual SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
|
||||||
|
protected:
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -199,3 +199,8 @@ SMDSAbs_EntityType SMDS_VtkFace::GetEntityType() const
|
|||||||
{
|
{
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_VtkFace::interlacedNodesElemIterator() const
|
||||||
|
{
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
|
}
|
||||||
|
@ -28,9 +28,10 @@ public:
|
|||||||
virtual bool IsQuadratic() const;
|
virtual bool IsQuadratic() const;
|
||||||
virtual bool IsPoly() const;
|
virtual bool IsPoly() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
||||||
|
virtual SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
|
||||||
|
protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,9 +77,9 @@ void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> n
|
|||||||
double a[3];
|
double a[3];
|
||||||
double b[3];
|
double b[3];
|
||||||
double c[3];
|
double c[3];
|
||||||
grid->GetPoints()->GetPoint(nodeIds[k],a);
|
grid->GetPoints()->GetPoint(nodeIds[k], a);
|
||||||
grid->GetPoints()->GetPoint(nodeIds[k+1],b);
|
grid->GetPoints()->GetPoint(nodeIds[k + 1], b);
|
||||||
grid->GetPoints()->GetPoint(nodeIds[k+2],c);
|
grid->GetPoints()->GetPoint(nodeIds[k + 2], c);
|
||||||
bool isFaceForward = this->isForward(a, b, c, center);
|
bool isFaceForward = this->isForward(a, b, c, center);
|
||||||
//MESSAGE("isFaceForward " << i << " " << isFaceForward);
|
//MESSAGE("isFaceForward " << i << " " << isFaceForward);
|
||||||
vtkIdType *facePts = &nodeIds[k];
|
vtkIdType *facePts = &nodeIds[k];
|
||||||
@ -87,7 +87,7 @@ void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> n
|
|||||||
for (int n = 0; n < nf; n++)
|
for (int n = 0; n < nf; n++)
|
||||||
ptIds.push_back(facePts[n]);
|
ptIds.push_back(facePts[n]);
|
||||||
else
|
else
|
||||||
for (int n = nf-1; n >= 0; n--)
|
for (int n = nf - 1; n >= 0; n--)
|
||||||
ptIds.push_back(facePts[n]);
|
ptIds.push_back(facePts[n]);
|
||||||
k += nf;
|
k += nf;
|
||||||
}
|
}
|
||||||
@ -106,7 +106,7 @@ bool SMDS_VtkVolume::ChangeNodes(const SMDS_MeshNode* nodes[], const int nbNodes
|
|||||||
MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
|
MESSAGE("ChangeNodes problem: not the same number of nodes " << npts << " -> " << nbNodes);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (int i=0; i<nbNodes; i++)
|
for (int i = 0; i < nbNodes; i++)
|
||||||
{
|
{
|
||||||
pts[i] = nodes[i]->GetID();
|
pts[i] = nodes[i]->GetID();
|
||||||
}
|
}
|
||||||
@ -149,9 +149,11 @@ int SMDS_VtkVolume::NbFaces() const
|
|||||||
vtkIdType* ptIds = 0;
|
vtkIdType* ptIds = 0;
|
||||||
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
|
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
|
||||||
nbFaces = nFaces;
|
nbFaces = nFaces;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
MESSAGE("invalid volume type");
|
MESSAGE("invalid volume type")
|
||||||
|
;
|
||||||
nbFaces = 0;
|
nbFaces = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -161,7 +163,25 @@ int SMDS_VtkVolume::NbFaces() const
|
|||||||
int SMDS_VtkVolume::NbNodes() const
|
int SMDS_VtkVolume::NbNodes() const
|
||||||
{
|
{
|
||||||
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
int nbPoints = grid->GetCell(myVtkID)->GetNumberOfPoints();
|
vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
|
||||||
|
int nbPoints = 0;
|
||||||
|
if (aVtkType != VTK_POLYHEDRON)
|
||||||
|
{
|
||||||
|
nbPoints = grid->GetCell(myVtkID)->GetNumberOfPoints();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vtkIdType nFaces = 0;
|
||||||
|
vtkIdType* ptIds = 0;
|
||||||
|
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
|
||||||
|
int id = 0;
|
||||||
|
for (int i = 0; i < nFaces; i++)
|
||||||
|
{
|
||||||
|
int nodesInFace = ptIds[id];
|
||||||
|
nbPoints += nodesInFace;
|
||||||
|
id += (nodesInFace + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
return nbPoints;
|
return nbPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,19 +225,111 @@ int SMDS_VtkVolume::NbEdges() const
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
MESSAGE("invalid volume type");
|
MESSAGE("invalid volume type")
|
||||||
|
;
|
||||||
nbEdges = 0;
|
nbEdges = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return nbEdges;
|
return nbEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! polyhedron only,
|
||||||
|
* 1 <= face_ind <= NbFaces()
|
||||||
|
*/
|
||||||
|
int SMDS_VtkVolume::NbFaceNodes(const int face_ind) const
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
|
||||||
|
int nbNodes = 0;
|
||||||
|
if (aVtkType == VTK_POLYHEDRON)
|
||||||
|
{
|
||||||
|
vtkIdType nFaces = 0;
|
||||||
|
vtkIdType* ptIds = 0;
|
||||||
|
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
|
||||||
|
int id = 0;
|
||||||
|
for (int i = 0; i < nFaces; i++)
|
||||||
|
{
|
||||||
|
int nodesInFace = ptIds[id];
|
||||||
|
id += (nodesInFace + 1);
|
||||||
|
if (i == face_ind - 1)
|
||||||
|
{
|
||||||
|
nbNodes = nodesInFace;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nbNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! polyhedron only,
|
||||||
|
* 1 <= face_ind <= NbFaces()
|
||||||
|
* 1 <= node_ind <= NbFaceNodes()
|
||||||
|
*/
|
||||||
|
const SMDS_MeshNode* SMDS_VtkVolume::GetFaceNode(const int face_ind, const int node_ind) const
|
||||||
|
{
|
||||||
|
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
|
||||||
|
vtkUnstructuredGrid* grid = mesh->getGrid();
|
||||||
|
vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
|
||||||
|
const SMDS_MeshNode* node = 0;
|
||||||
|
if (aVtkType == VTK_POLYHEDRON)
|
||||||
|
{
|
||||||
|
vtkIdType nFaces = 0;
|
||||||
|
vtkIdType* ptIds = 0;
|
||||||
|
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
|
||||||
|
int id = 0;
|
||||||
|
for (int i = 0; i < nFaces; i++)
|
||||||
|
{
|
||||||
|
int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
|
||||||
|
if (i == face_ind - 1) // first face is number 1
|
||||||
|
{
|
||||||
|
if ((node_ind > 0) && (node_ind <= nodesInFace))
|
||||||
|
node = mesh->FindNode(ptIds[id + node_ind]); // ptIds[id+1] : first node
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
id += (nodesInFace + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! polyhedron only,
|
||||||
|
* return number of nodes for each face
|
||||||
|
*/
|
||||||
|
const std::vector<int> & SMDS_VtkVolume::GetQuantities() const
|
||||||
|
{
|
||||||
|
vector<int> quantities;
|
||||||
|
quantities.clear();
|
||||||
|
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
|
||||||
|
vtkUnstructuredGrid* grid = mesh->getGrid();
|
||||||
|
vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
|
||||||
|
if (aVtkType == VTK_POLYHEDRON)
|
||||||
|
{
|
||||||
|
vtkIdType nFaces = 0;
|
||||||
|
vtkIdType* ptIds = 0;
|
||||||
|
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
|
||||||
|
int id = 0;
|
||||||
|
for (int i = 0; i < nFaces; i++)
|
||||||
|
{
|
||||||
|
int nodesInFace = ptIds[id]; // nodeIds in ptIds[id+1 .. id+nodesInFace]
|
||||||
|
quantities.push_back(nodesInFace);
|
||||||
|
id += (nodesInFace + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return quantities;
|
||||||
|
}
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr SMDS_VtkVolume::elementsIterator(SMDSAbs_ElementType type) const
|
SMDS_ElemIteratorPtr SMDS_VtkVolume::elementsIterator(SMDSAbs_ElementType type) const
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SMDSAbs_Node:
|
case SMDSAbs_Node:
|
||||||
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
{
|
||||||
|
SMDSAbs_EntityType aType = this->GetEntityType();
|
||||||
|
if (aType == SMDSEntity_Polyhedra)
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorPolyH(SMDS_Mesh::_meshList[myMeshId], myVtkID, aType));
|
||||||
|
else
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, aType));
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
MESSAGE("ERROR : Iterator not implemented");
|
MESSAGE("ERROR : Iterator not implemented");
|
||||||
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*) NULL);
|
||||||
@ -229,6 +341,10 @@ SMDS_ElemIteratorPtr SMDS_VtkVolume::nodesIteratorToUNV() const
|
|||||||
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr SMDS_VtkVolume::interlacedNodesElemIterator() const
|
||||||
|
{
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIteratorToUNV(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
|
}
|
||||||
|
|
||||||
SMDSAbs_ElementType SMDS_VtkVolume::GetType() const
|
SMDSAbs_ElementType SMDS_VtkVolume::GetType() const
|
||||||
{
|
{
|
||||||
@ -242,7 +358,8 @@ SMDSAbs_ElementType SMDS_VtkVolume::GetType() const
|
|||||||
*/
|
*/
|
||||||
const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
|
const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
|
||||||
{
|
{
|
||||||
return SMDS_MeshElement::GetNode(ind); // --- a optimiser !
|
// TODO optimize if possible (vtkCellIterator)
|
||||||
|
return SMDS_MeshElement::GetNode(ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMDS_VtkVolume::IsQuadratic() const
|
bool SMDS_VtkVolume::IsQuadratic() const
|
||||||
@ -321,26 +438,26 @@ vtkIdType SMDS_VtkVolume::GetVtkType() const
|
|||||||
return aType;
|
return aType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SMDS_VtkVolume::gravityCenter(SMDS_UnstructuredGrid* grid, vtkIdType *nodeIds, int nbNodes, double* result)
|
void SMDS_VtkVolume::gravityCenter(SMDS_UnstructuredGrid* grid, vtkIdType *nodeIds, int nbNodes, double* result)
|
||||||
{
|
{
|
||||||
for (int j=0; j<3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
result[j] = 0;
|
result[j] = 0;
|
||||||
if (nbNodes <= 0)
|
if (nbNodes <= 0)
|
||||||
return;
|
return;
|
||||||
for (int i =0; i< nbNodes; i++)
|
for (int i = 0; i < nbNodes; i++)
|
||||||
{
|
{
|
||||||
double *coords = grid->GetPoint(nodeIds[i]);
|
double *coords = grid->GetPoint(nodeIds[i]);
|
||||||
for (int j=0; j<3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
result[j] += coords[j];
|
result[j] += coords[j];
|
||||||
}
|
}
|
||||||
for (int j=0; j<3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
result[j] = result[j]/nbNodes;
|
result[j] = result[j] / nbNodes;
|
||||||
//MESSAGE("center " << result[0] << " " << result[1] << " " << result[2]);
|
//MESSAGE("center " << result[0] << " " << result[1] << " " << result[2]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SMDS_VtkVolume::isForward(double* a,double* b,double* c,double* d)
|
bool SMDS_VtkVolume::isForward(double* a, double* b, double* c, double* d)
|
||||||
{
|
{
|
||||||
double u[3], v[3], w[3];
|
double u[3], v[3], w[3];
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
{
|
{
|
||||||
@ -350,8 +467,25 @@ vtkIdType SMDS_VtkVolume::GetVtkType() const
|
|||||||
w[j] = d[j] - a[j];
|
w[j] = d[j] - a[j];
|
||||||
//MESSAGE("u,v,w " << u[j] << " " << v[j] << " " << w[j]);
|
//MESSAGE("u,v,w " << u[j] << " " << v[j] << " " << w[j]);
|
||||||
}
|
}
|
||||||
double prodmixte = (u[2] * v[3] - u[3] * v[2]) * w[1]
|
double prodmixte = (u[2] * v[3] - u[3] * v[2]) * w[1] + (u[3] * v[1] - u[1] * v[3]) * w[2] + (u[1] * v[2] - u[2]
|
||||||
+ (u[3] * v[1] - u[1] * v[3]) * w[2]
|
* v[1]) * w[3];
|
||||||
+ (u[1] * v[2] - u[2] * v[1]) * w[3];
|
|
||||||
return (prodmixte >= 0);
|
return (prodmixte >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! For polyhedron only
|
||||||
|
* @return actual number of nodes (not the sum of nodes of all faces)
|
||||||
|
*/
|
||||||
|
int SMDS_VtkVolume::NbUniqueNodes() const
|
||||||
|
{
|
||||||
|
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||||
|
return grid->GetCell(myVtkID)->GetNumberOfPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! For polyhedron use only
|
||||||
|
* @return iterator on actual nodes (not through the faces)
|
||||||
|
*/
|
||||||
|
SMDS_ElemIteratorPtr SMDS_VtkVolume::uniqueNodesIterator() const
|
||||||
|
{
|
||||||
|
MESSAGE("uniqueNodesIterator");
|
||||||
|
return SMDS_ElemIteratorPtr(new SMDS_VtkCellIterator(SMDS_Mesh::_meshList[myMeshId], myVtkID, GetEntityType()));
|
||||||
|
}
|
||||||
|
@ -23,6 +23,13 @@ public:
|
|||||||
int NbFaces() const;
|
int NbFaces() const;
|
||||||
int NbNodes() const;
|
int NbNodes() const;
|
||||||
int NbEdges() const;
|
int NbEdges() const;
|
||||||
|
|
||||||
|
// 1 <= face_ind <= NbFaces()
|
||||||
|
int NbFaceNodes (const int face_ind) const;
|
||||||
|
// 1 <= face_ind <= NbFaces()
|
||||||
|
// 1 <= node_ind <= NbFaceNodes()
|
||||||
|
const SMDS_MeshNode* GetFaceNode (const int face_ind, const int node_ind) const;
|
||||||
|
|
||||||
virtual SMDSAbs_ElementType GetType() const;
|
virtual SMDSAbs_ElementType GetType() const;
|
||||||
virtual vtkIdType GetVtkType() const;
|
virtual vtkIdType GetVtkType() const;
|
||||||
virtual SMDSAbs_EntityType GetEntityType() const;
|
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||||
@ -34,10 +41,15 @@ public:
|
|||||||
int nbNodes,
|
int nbNodes,
|
||||||
double* result);
|
double* result);
|
||||||
static bool isForward(double* a,double* b,double* c,double* d);
|
static bool isForward(double* a,double* b,double* c,double* d);
|
||||||
|
int NbUniqueNodes() const;
|
||||||
|
SMDS_ElemIteratorPtr uniqueNodesIterator() const;
|
||||||
|
const std::vector<int> & GetQuantities() const;
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
virtual SMDS_ElemIteratorPtr elementsIterator(SMDSAbs_ElementType type) const;
|
||||||
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
virtual SMDS_ElemIteratorPtr nodesIteratorToUNV() const;
|
||||||
|
virtual SMDS_ElemIteratorPtr interlacedNodesElemIterator() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
#include "SMDS_PolyhedralVolumeOfNodes.hxx"
|
||||||
#include "SMDS_FacePosition.hxx"
|
#include "SMDS_FacePosition.hxx"
|
||||||
#include "SMDS_SpacePosition.hxx"
|
#include "SMDS_SpacePosition.hxx"
|
||||||
#include "SMDS_QuadraticFaceOfNodes.hxx"
|
//#include "SMDS_QuadraticFaceOfNodes.hxx"
|
||||||
#include "SMDS_MeshGroup.hxx"
|
#include "SMDS_MeshGroup.hxx"
|
||||||
#include "SMDS_LinearEdge.hxx"
|
#include "SMDS_LinearEdge.hxx"
|
||||||
#include "SMDS_Downward.hxx"
|
#include "SMDS_Downward.hxx"
|
||||||
@ -906,8 +906,8 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
|
|||||||
if (theElem->IsPoly()) {
|
if (theElem->IsPoly()) {
|
||||||
// TODO reorient vtk polyhedron
|
// TODO reorient vtk polyhedron
|
||||||
MESSAGE("reorient vtk polyhedron ?");
|
MESSAGE("reorient vtk polyhedron ?");
|
||||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
const SMDS_VtkVolume* aPolyedre =
|
||||||
static_cast<const SMDS_PolyhedralVolumeOfNodes*>( theElem );
|
dynamic_cast<const SMDS_VtkVolume*>( theElem );
|
||||||
if (!aPolyedre) {
|
if (!aPolyedre) {
|
||||||
MESSAGE("Warning: bad volumic element");
|
MESSAGE("Warning: bad volumic element");
|
||||||
return false;
|
return false;
|
||||||
@ -3176,14 +3176,14 @@ void SMESH_MeshEditor::Smooth (TIDSortedElemSet & theElems,
|
|||||||
helper.SetSubShape( face );
|
helper.SetSubShape( face );
|
||||||
list< const SMDS_MeshElement* >::iterator elemIt = elemsOnFace.begin();
|
list< const SMDS_MeshElement* >::iterator elemIt = elemsOnFace.begin();
|
||||||
for ( ; elemIt != elemsOnFace.end(); ++elemIt ) {
|
for ( ; elemIt != elemsOnFace.end(); ++elemIt ) {
|
||||||
const SMDS_QuadraticFaceOfNodes* QF =
|
const SMDS_VtkFace* QF =
|
||||||
dynamic_cast<const SMDS_QuadraticFaceOfNodes*> (*elemIt);
|
dynamic_cast<const SMDS_VtkFace*> (*elemIt);
|
||||||
if(QF) {
|
if(QF && QF->IsQuadratic()) {
|
||||||
vector<const SMDS_MeshNode*> Ns;
|
vector<const SMDS_MeshNode*> Ns;
|
||||||
Ns.reserve(QF->NbNodes()+1);
|
Ns.reserve(QF->NbNodes()+1);
|
||||||
SMDS_NodeIteratorPtr anIter = QF->interlacedNodesIterator();
|
SMDS_ElemIteratorPtr anIter = QF->interlacedNodesElemIterator();
|
||||||
while ( anIter->more() )
|
while ( anIter->more() )
|
||||||
Ns.push_back( anIter->next() );
|
Ns.push_back( cast2Node(anIter->next()) );
|
||||||
Ns.push_back( Ns[0] );
|
Ns.push_back( Ns[0] );
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
for(int i=0; i<QF->NbNodes(); i=i+2) {
|
for(int i=0; i<QF->NbNodes(); i=i+2) {
|
||||||
@ -5317,8 +5317,8 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
|||||||
case SMDSAbs_Volume:
|
case SMDSAbs_Volume:
|
||||||
{
|
{
|
||||||
// ATTENTION: Reversing is not yet done!!!
|
// ATTENTION: Reversing is not yet done!!!
|
||||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
const SMDS_VtkVolume* aPolyedre =
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
|
dynamic_cast<const SMDS_VtkVolume*>( elem );
|
||||||
if (!aPolyedre) {
|
if (!aPolyedre) {
|
||||||
MESSAGE("Warning: bad volumic element");
|
MESSAGE("Warning: bad volumic element");
|
||||||
continue;
|
continue;
|
||||||
@ -5640,8 +5640,8 @@ SMESH_MeshEditor::Scale (TIDSortedElemSet & theElems,
|
|||||||
case SMDSAbs_Volume:
|
case SMDSAbs_Volume:
|
||||||
{
|
{
|
||||||
// ATTENTION: Reversing is not yet done!!!
|
// ATTENTION: Reversing is not yet done!!!
|
||||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
const SMDS_VtkVolume* aPolyedre =
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
|
dynamic_cast<const SMDS_VtkVolume*>( elem );
|
||||||
if (!aPolyedre) {
|
if (!aPolyedre) {
|
||||||
MESSAGE("Warning: bad volumic element");
|
MESSAGE("Warning: bad volumic element");
|
||||||
continue;
|
continue;
|
||||||
@ -6836,9 +6836,9 @@ bool SMESH_MeshEditor::isOut( const SMDS_MeshElement* element, const gp_Pnt& poi
|
|||||||
|
|
||||||
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
|
SMDS_ElemIteratorPtr nodeIt = element->nodesIterator();
|
||||||
if ( element->IsQuadratic() )
|
if ( element->IsQuadratic() )
|
||||||
if (const SMDS_QuadraticFaceOfNodes* f=dynamic_cast<const SMDS_QuadraticFaceOfNodes*>(element))
|
if (const SMDS_VtkFace* f=dynamic_cast<const SMDS_VtkFace*>(element))
|
||||||
nodeIt = f->interlacedNodesElemIterator();
|
nodeIt = f->interlacedNodesElemIterator();
|
||||||
else if (const SMDS_QuadraticEdge* e =dynamic_cast<const SMDS_QuadraticEdge*>(element))
|
else if (const SMDS_VtkEdge* e =dynamic_cast<const SMDS_VtkEdge*>(element))
|
||||||
nodeIt = e->interlacedNodesElemIterator();
|
nodeIt = e->interlacedNodesElemIterator();
|
||||||
|
|
||||||
while ( nodeIt->more() )
|
while ( nodeIt->more() )
|
||||||
@ -7182,8 +7182,19 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
if (aShapeId)
|
if (aShapeId)
|
||||||
aMesh->SetMeshElementOnShape(newElem, aShapeId);
|
aMesh->SetMeshElementOnShape(newElem, aShapeId);
|
||||||
}
|
}
|
||||||
MESSAGE("ChangeElementNodes MergeNodes Poly");
|
|
||||||
aMesh->ChangeElementNodes(elem, &polygons_nodes[inode], quantities[nbNew - 1]);
|
MESSAGE("ChangeElementNodes MergeNodes Polygon");
|
||||||
|
//aMesh->ChangeElementNodes(elem, &polygons_nodes[inode], quantities[nbNew - 1]);
|
||||||
|
vector<const SMDS_MeshNode *> polynodes(polygons_nodes.begin()+inode,polygons_nodes.end());
|
||||||
|
int quid =0;
|
||||||
|
if (nbNew > 0) quid = nbNew - 1;
|
||||||
|
vector<int> newquant(quantities.begin()+quid, quantities.end());
|
||||||
|
const SMDS_MeshElement* newElem = 0;
|
||||||
|
newElem = aMesh->AddPolyhedralVolume(polynodes, newquant);
|
||||||
|
myLastCreatedElems.Append(newElem);
|
||||||
|
if ( aShapeId && newElem )
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
|
rmElemIds.push_back(elem->GetID());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rmElemIds.push_back(elem->GetID());
|
rmElemIds.push_back(elem->GetID());
|
||||||
@ -7196,9 +7207,9 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
rmElemIds.push_back(elem->GetID());
|
rmElemIds.push_back(elem->GetID());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// each face has to be analized in order to check volume validity
|
// each face has to be analyzed in order to check volume validity
|
||||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
const SMDS_VtkVolume* aPolyedre =
|
||||||
static_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
|
dynamic_cast<const SMDS_VtkVolume*>( elem );
|
||||||
if (aPolyedre) {
|
if (aPolyedre) {
|
||||||
int nbFaces = aPolyedre->NbFaces();
|
int nbFaces = aPolyedre->NbFaces();
|
||||||
|
|
||||||
@ -7226,10 +7237,16 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (quantities.size() > 3)
|
if (quantities.size() > 3)
|
||||||
aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
|
{
|
||||||
else
|
MESSAGE("ChangeElementNodes MergeNodes Polyhedron");
|
||||||
|
//aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
|
||||||
|
const SMDS_MeshElement* newElem = 0;
|
||||||
|
newElem = aMesh->AddPolyhedralVolume(poly_nodes, quantities);
|
||||||
|
myLastCreatedElems.Append(newElem);
|
||||||
|
if ( aShapeId && newElem )
|
||||||
|
aMesh->SetMeshElementOnShape( newElem, aShapeId );
|
||||||
rmElemIds.push_back(elem->GetID());
|
rmElemIds.push_back(elem->GetID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rmElemIds.push_back(elem->GetID());
|
rmElemIds.push_back(elem->GetID());
|
||||||
@ -7580,8 +7597,8 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
if ( isOk ) {
|
if ( isOk ) {
|
||||||
if (elem->IsPoly() && elem->GetType() == SMDSAbs_Volume) {
|
if (elem->IsPoly() && elem->GetType() == SMDSAbs_Volume) {
|
||||||
// Change nodes of polyedre
|
// Change nodes of polyedre
|
||||||
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
const SMDS_VtkVolume* aPolyedre =
|
||||||
static_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
|
dynamic_cast<const SMDS_VtkVolume*>( elem );
|
||||||
if (aPolyedre) {
|
if (aPolyedre) {
|
||||||
int nbFaces = aPolyedre->NbFaces();
|
int nbFaces = aPolyedre->NbFaces();
|
||||||
|
|
||||||
@ -7815,10 +7832,11 @@ SMESH_MeshEditor::FindFaceInSet(const SMDS_MeshNode* n1,
|
|||||||
if ( !face && elem->IsQuadratic())
|
if ( !face && elem->IsQuadratic())
|
||||||
{
|
{
|
||||||
// analysis for quadratic elements using all nodes
|
// analysis for quadratic elements using all nodes
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_VtkFace* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(elem);
|
dynamic_cast<const SMDS_VtkFace*>(elem);
|
||||||
|
if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
|
||||||
const SMDS_MeshNode* prevN = cast2Node( anIter->next() );
|
const SMDS_MeshNode* prevN = cast2Node( anIter->next() );
|
||||||
for ( i1 = -1, i2 = 0; anIter->more() && !face; i1++, i2++ )
|
for ( i1 = -1, i2 = 0; anIter->more() && !face; i1++, i2++ )
|
||||||
{
|
{
|
||||||
@ -7902,12 +7920,13 @@ bool SMESH_MeshEditor::FindFreeBorder (const SMDS_MeshNode* theFirst
|
|||||||
vector<const SMDS_MeshNode*> nodes(nbNodes+1);
|
vector<const SMDS_MeshNode*> nodes(nbNodes+1);
|
||||||
|
|
||||||
if(e->IsQuadratic()) {
|
if(e->IsQuadratic()) {
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_VtkFace* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(e);
|
dynamic_cast<const SMDS_VtkFace*>(e);
|
||||||
|
if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
|
||||||
while( anIter->more() ) {
|
while( anIter->more() ) {
|
||||||
nodes[ iNode++ ] = anIter->next();
|
nodes[ iNode++ ] = cast2Node(anIter->next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -8175,12 +8194,13 @@ SMESH_MeshEditor::SewFreeBorder (const SMDS_MeshNode* theBordFirstNode,
|
|||||||
else if ( elem->GetType()==SMDSAbs_Face ) { // --face
|
else if ( elem->GetType()==SMDSAbs_Face ) { // --face
|
||||||
// retrieve all face nodes and find iPrevNode - an index of the prevSideNode
|
// retrieve all face nodes and find iPrevNode - an index of the prevSideNode
|
||||||
if(elem->IsQuadratic()) {
|
if(elem->IsQuadratic()) {
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_VtkFace* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(elem);
|
dynamic_cast<const SMDS_VtkFace*>(elem);
|
||||||
|
if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
|
||||||
while( anIter->more() ) {
|
while( anIter->more() ) {
|
||||||
nodes[ iNode ] = anIter->next();
|
nodes[ iNode ] = cast2Node(anIter->next());
|
||||||
if ( nodes[ iNode++ ] == prevSideNode )
|
if ( nodes[ iNode++ ] == prevSideNode )
|
||||||
iPrevNode = iNode - 1;
|
iPrevNode = iNode - 1;
|
||||||
}
|
}
|
||||||
@ -8494,12 +8514,13 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement* theFace,
|
|||||||
vector<const SMDS_MeshNode*> nodes( theFace->NbNodes() );
|
vector<const SMDS_MeshNode*> nodes( theFace->NbNodes() );
|
||||||
|
|
||||||
if(theFace->IsQuadratic()) {
|
if(theFace->IsQuadratic()) {
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_VtkFace* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(theFace);
|
dynamic_cast<const SMDS_VtkFace*>(theFace);
|
||||||
|
if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
|
||||||
while( anIter->more() ) {
|
while( anIter->more() ) {
|
||||||
const SMDS_MeshNode* n = anIter->next();
|
const SMDS_MeshNode* n = cast2Node(anIter->next());
|
||||||
if ( n == theBetweenNode1 )
|
if ( n == theBetweenNode1 )
|
||||||
il1 = iNode;
|
il1 = iNode;
|
||||||
else if ( n == theBetweenNode2 )
|
else if ( n == theBetweenNode2 )
|
||||||
@ -8555,12 +8576,13 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement* theFace,
|
|||||||
bool isFLN = false;
|
bool isFLN = false;
|
||||||
|
|
||||||
if(theFace->IsQuadratic()) {
|
if(theFace->IsQuadratic()) {
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_VtkFace* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(theFace);
|
dynamic_cast<const SMDS_VtkFace*>(theFace);
|
||||||
|
if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
|
||||||
while( anIter->more() && !isFLN ) {
|
while( anIter->more() && !isFLN ) {
|
||||||
const SMDS_MeshNode* n = anIter->next();
|
const SMDS_MeshNode* n = cast2Node(anIter->next());
|
||||||
poly_nodes[iNode++] = n;
|
poly_nodes[iNode++] = n;
|
||||||
if (n == nodes[il1]) {
|
if (n == nodes[il1]) {
|
||||||
isFLN = true;
|
isFLN = true;
|
||||||
@ -8573,7 +8595,7 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement* theFace,
|
|||||||
}
|
}
|
||||||
// add nodes of face starting from last node of link
|
// add nodes of face starting from last node of link
|
||||||
while ( anIter->more() ) {
|
while ( anIter->more() ) {
|
||||||
poly_nodes[iNode++] = anIter->next();
|
poly_nodes[iNode++] = cast2Node(anIter->next());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -9618,10 +9640,11 @@ SMESH_MeshEditor::SewSideElements (TIDSortedElemSet& theSide1,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // f->IsQuadratic()
|
else { // f->IsQuadratic()
|
||||||
const SMDS_QuadraticFaceOfNodes* F =
|
const SMDS_VtkFace* F =
|
||||||
static_cast<const SMDS_QuadraticFaceOfNodes*>(f);
|
dynamic_cast<const SMDS_VtkFace*>(f);
|
||||||
|
if (!F) throw SALOME_Exception(LOCALIZED("not an SMDS_VtkFace"));
|
||||||
// use special nodes iterator
|
// use special nodes iterator
|
||||||
SMDS_NodeIteratorPtr anIter = F->interlacedNodesIterator();
|
SMDS_ElemIteratorPtr anIter = F->interlacedNodesElemIterator();
|
||||||
while ( anIter->more() ) {
|
while ( anIter->more() ) {
|
||||||
const SMDS_MeshNode* n =
|
const SMDS_MeshNode* n =
|
||||||
static_cast<const SMDS_MeshNode*>( anIter->next() );
|
static_cast<const SMDS_MeshNode*>( anIter->next() );
|
||||||
|
@ -1997,11 +1997,11 @@ SMESH_Gen_i::ConcatenateCommon(const SMESH::mesh_array& theMeshesArray,
|
|||||||
// creates a corresponding element on existent nodes in new mesh
|
// creates a corresponding element on existent nodes in new mesh
|
||||||
if ( anElem->IsPoly() && anElemType == SMDSAbs_Volume )
|
if ( anElem->IsPoly() && anElemType == SMDSAbs_Volume )
|
||||||
{
|
{
|
||||||
const SMDS_PolyhedralVolumeOfNodes* aVolume =
|
const SMDS_VtkVolume* aVolume =
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem);
|
dynamic_cast<const SMDS_VtkVolume*> (anElem);
|
||||||
if ( aVolume ) {
|
if ( aVolume ) {
|
||||||
aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
|
aNewElem = aNewMeshDS->AddPolyhedralVolume(aNodesArray,
|
||||||
aVolume->GetQuanities());
|
aVolume->GetQuantities());
|
||||||
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
|
elemsMap.insert(make_pair(anElem->GetID(), aNewElem->GetID()));
|
||||||
if( theCommonGroups )
|
if( theCommonGroups )
|
||||||
anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
|
anIDsVolumes[anNbVolumes++] = aNewElem->GetID();
|
||||||
|
@ -129,11 +129,11 @@ namespace {
|
|||||||
SMDS_MeshElement* anElemCopy = 0;
|
SMDS_MeshElement* anElemCopy = 0;
|
||||||
if ( anElem->IsPoly() && anElem->GetType() == SMDSAbs_Volume )
|
if ( anElem->IsPoly() && anElem->GetType() == SMDSAbs_Volume )
|
||||||
{
|
{
|
||||||
const SMDS_PolyhedralVolumeOfNodes* ph =
|
const SMDS_VtkVolume* ph =
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*> (anElem);
|
dynamic_cast<const SMDS_VtkVolume*> (anElem);
|
||||||
if ( ph )
|
if ( ph )
|
||||||
anElemCopy = _myMeshDS->AddPolyhedralVolumeWithID
|
anElemCopy = _myMeshDS->AddPolyhedralVolumeWithID
|
||||||
(anElemNodesID, ph->GetQuanities(),anElem->GetID());
|
(anElemNodesID, ph->GetQuantities(),anElem->GetID());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
anElemCopy = ::SMESH_MeshEditor(this).AddElement( anElemNodesID,
|
anElemCopy = ::SMESH_MeshEditor(this).AddElement( anElemNodesID,
|
||||||
|
@ -407,11 +407,13 @@ bool StdMeshers_Projection_3D::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aS
|
|||||||
nodes[6],
|
nodes[6],
|
||||||
nodes[7], id, force3d); break;
|
nodes[7], id, force3d); break;
|
||||||
default: // polyhedron
|
default: // polyhedron
|
||||||
const SMDS_PolyhedralVolumeOfNodes * poly =
|
const SMDS_VtkVolume * poly =
|
||||||
dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( srcVol );
|
dynamic_cast<const SMDS_VtkVolume*>( srcVol );
|
||||||
if ( !poly )
|
if ( !poly )
|
||||||
RETURN_BAD_RESULT("Unexpected volume type");
|
RETURN_BAD_RESULT("Unexpected volume type");
|
||||||
tgtVol = tgtMeshDS->AddPolyhedralVolume( nodes, poly->GetQuanities() );
|
if ( !poly->IsPoly())
|
||||||
|
RETURN_BAD_RESULT("Unexpected volume type");
|
||||||
|
tgtVol = tgtMeshDS->AddPolyhedralVolume( nodes, poly->GetQuantities() );
|
||||||
}
|
}
|
||||||
if ( tgtVol ) {
|
if ( tgtVol ) {
|
||||||
tgtMeshDS->SetMeshElementOnShape( tgtVol, helper.GetSubShapeID() );
|
tgtMeshDS->SetMeshElementOnShape( tgtVol, helper.GetSubShapeID() );
|
||||||
|
Loading…
Reference in New Issue
Block a user