Update quadratic elements by the script

This commit is contained in:
eap 2006-05-04 13:46:01 +00:00
parent 830094fe0a
commit e018834cab

View File

@ -63,18 +63,27 @@ static int MYDEBUG = 0;
namespace
{
//=======================================================================
//function : FindNode
//=======================================================================
inline const SMDS_MeshNode* FindNode(const SMDS_Mesh* theMesh, int theId){
if(const SMDS_MeshNode* anElem = theMesh->FindNode(theId)) return anElem;
EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
}
//=======================================================================
//function : FindElement
//=======================================================================
inline const SMDS_MeshElement* FindElement(const SMDS_Mesh* theMesh, int theId){
if(const SMDS_MeshElement* anElem = theMesh->FindElement(theId)) return anElem;
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot find a SMDS_MeshElement for ID = "<<theId);
}
//=======================================================================
//function : AddNodesWithID
//=======================================================================
inline void AddNodesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -95,6 +104,9 @@ namespace
}
//=======================================================================
//function : AddEdgesWithID
//=======================================================================
inline void AddEdgesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -113,6 +125,9 @@ namespace
}
//=======================================================================
//function : AddTriasWithID
//=======================================================================
inline void AddTriasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -120,7 +135,7 @@ namespace
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(4*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 4*aNbElems != anIndexes.length()");
EXCEPTION(runtime_error,"AddTriasWithID - 4*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=4){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
@ -132,6 +147,9 @@ namespace
}
//=======================================================================
//function : AddQuadsWithID
//=======================================================================
inline void AddQuadsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var theSeq,
CORBA::Long theId)
@ -139,7 +157,7 @@ namespace
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(5*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 4*aNbElems != anIndexes.length()");
EXCEPTION(runtime_error,"AddQuadsWithID - 4*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=5){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
@ -152,6 +170,9 @@ namespace
}
//=======================================================================
//function : AddPolygonsWithID
//=======================================================================
inline void AddPolygonsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -176,6 +197,9 @@ namespace
}
//=======================================================================
//function : AddTetrasWithID
//=======================================================================
inline void AddTetrasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -183,7 +207,7 @@ namespace
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(5*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 5*aNbElems != anIndexes.length()");
EXCEPTION(runtime_error,"AddTetrasWithID - 5*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=5){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
@ -196,6 +220,9 @@ namespace
}
//=======================================================================
//function : AddPiramidsWithID
//=======================================================================
inline void AddPiramidsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -203,7 +230,7 @@ namespace
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(6*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 6*aNbElems != anIndexes.length()");
EXCEPTION(runtime_error,"AddPiramidsWithID - 6*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=6){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
@ -217,6 +244,9 @@ namespace
}
//=======================================================================
//function : AddPrismsWithID
//=======================================================================
inline void AddPrismsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -224,7 +254,7 @@ namespace
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(7*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 7*aNbElems != anIndexes.length()");
EXCEPTION(runtime_error,"AddPrismsWithID - 7*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=7){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
@ -239,6 +269,9 @@ namespace
}
//=======================================================================
//function : AddHexasWithID
//=======================================================================
inline void AddHexasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -246,7 +279,7 @@ namespace
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(9*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 9*aNbElems != anIndexes.length()");
EXCEPTION(runtime_error,"AddHexasWithID - 9*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=9){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
@ -263,6 +296,9 @@ namespace
}
//=======================================================================
//function : AddPolyhedronsWithID
//=======================================================================
inline void AddPolyhedronsWithID (SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -294,6 +330,217 @@ namespace
}
//=======================================================================
//function : AddQuadEdgesWithID
//=======================================================================
inline void AddQuadEdgesWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(4*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddQuadEdgeWithID - 4*aNbElems != aCoords.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=4){
SMDS_MeshElement* anElem = theMesh->AddEdgeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
anIndexes[anIndexId+3],
anIndexes[anIndexId]);
if(!anElem)
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddEdgeWithID for ID = "<<anElemId);
}
}
//=======================================================================
//function : AddQuadTriasWithID
//=======================================================================
inline void AddQuadTriasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(7*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddQuadTriasWithID - 7*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=7){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
anIndexes[anIndexId+3],
anIndexes[anIndexId+4],
anIndexes[anIndexId+5],
anIndexes[anIndexId+6],
anIndexes[anIndexId]);
if(!anElem)
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
}
}
//=======================================================================
//function : AddQuadQuadsWithID
//=======================================================================
inline void AddQuadQuadsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var theSeq,
CORBA::Long theId)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(9*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddQuadQuadsWithID - 9*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=9){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
anIndexes[anIndexId+3],
anIndexes[anIndexId+4],
anIndexes[anIndexId+5],
anIndexes[anIndexId+6],
anIndexes[anIndexId+7],
anIndexes[anIndexId+8],
anIndexes[anIndexId]);
if(!anElem)
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddFaceWithID for ID = "<<anElemId);
}
}
//=======================================================================
//function : AddQuadTetrasWithID
//=======================================================================
inline void AddQuadTetrasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(11*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddQuadTetrasWithID - 11*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=11){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
anIndexes[anIndexId+3],
anIndexes[anIndexId+4],
anIndexes[anIndexId+5],
anIndexes[anIndexId+6],
anIndexes[anIndexId+7],
anIndexes[anIndexId+8],
anIndexes[anIndexId+9],
anIndexes[anIndexId+10],
anIndexes[anIndexId]);
if(!anElem)
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
}
}
//=======================================================================
//function : AddQuadPiramidsWithID
//=======================================================================
inline void AddQuadPiramidsWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(14*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddQuadPiramidsWithID - 14*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=14){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
anIndexes[anIndexId+3],
anIndexes[anIndexId+4],
anIndexes[anIndexId+5],
anIndexes[anIndexId+6],
anIndexes[anIndexId+7],
anIndexes[anIndexId+8],
anIndexes[anIndexId+9],
anIndexes[anIndexId+10],
anIndexes[anIndexId+11],
anIndexes[anIndexId+12],
anIndexes[anIndexId+13],
anIndexes[anIndexId]);
if(!anElem)
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
}
}
//=======================================================================
//function : AddQuadPentasWithID
//=======================================================================
inline void AddQuadPentasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(16*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddQuadPentasWithID - 16*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=16){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
anIndexes[anIndexId+3],
anIndexes[anIndexId+4],
anIndexes[anIndexId+5],
anIndexes[anIndexId+6],
anIndexes[anIndexId+7],
anIndexes[anIndexId+8],
anIndexes[anIndexId+9],
anIndexes[anIndexId+10],
anIndexes[anIndexId+11],
anIndexes[anIndexId+12],
anIndexes[anIndexId+13],
anIndexes[anIndexId+14],
anIndexes[anIndexId+15],
anIndexes[anIndexId]);
if(!anElem)
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
}
}
//=======================================================================
//function : AddQuadHexasWithID
//=======================================================================
inline void AddQuadHexasWithID(SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(21*aNbElems != anIndexes.length())
EXCEPTION(runtime_error,"AddQuadHexasWithID - 21*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=21){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
anIndexes[anIndexId+2],
anIndexes[anIndexId+3],
anIndexes[anIndexId+4],
anIndexes[anIndexId+5],
anIndexes[anIndexId+6],
anIndexes[anIndexId+7],
anIndexes[anIndexId+8],
anIndexes[anIndexId+9],
anIndexes[anIndexId+10],
anIndexes[anIndexId+11],
anIndexes[anIndexId+12],
anIndexes[anIndexId+13],
anIndexes[anIndexId+14],
anIndexes[anIndexId+15],
anIndexes[anIndexId+16],
anIndexes[anIndexId+17],
anIndexes[anIndexId+18],
anIndexes[anIndexId+19],
anIndexes[anIndexId+20],
anIndexes[anIndexId]);
if(!anElem)
EXCEPTION(runtime_error,"SMDS_Mesh::FindElement - cannot AddVolumeWithID for ID = "<<anElemId);
}
}
//=======================================================================
//function : ChangePolyhedronNodes
//=======================================================================
inline void ChangePolyhedronNodes (SMDS_Mesh* theMesh,
SMESH::log_array_var& theSeq,
CORBA::Long theId)
@ -466,6 +713,14 @@ SMESH_Client::Update(bool theIsClear)
case SMESH::ADD_HEXAHEDRON : AddHexasWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_POLYHEDRON : AddPolyhedronsWithID( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADEDGE : AddQuadEdgesWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADTRIANGLE : AddQuadTriasWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADQUADRANGLE : AddQuadQuadsWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADTETRAHEDRON: AddQuadTetrasWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADPYRAMID : AddQuadPiramidsWithID( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADPENTAHEDRON: AddQuadPentasWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::ADD_QUADHEXAHEDRON : AddQuadHexasWithID ( mySMDSMesh, aSeq, anId ); break;
case SMESH::REMOVE_NODE:
for( ; anElemId < aNbElems; anElemId++ )
mySMDSMesh->RemoveNode( FindNode( mySMDSMesh, anIndexes[anElemId] ) );