[bos #40649][CEA] include support to export when cgns is compile with option DCGNS_ENABLE_64BIT:BOOL=ON

This commit is contained in:
cconopoima 2024-05-28 14:24:17 +01:00
parent 453bbcd621
commit 3c7d932660
5 changed files with 117 additions and 102 deletions

View File

@ -290,12 +290,16 @@ Driver_Mesh::Status DriverStructuredCGNS_Write::Perform()
grid->GetFaceInterfaces(myMesh->GetTheGrid(neighbourSolid).get(), interface);
if ( !interface.empty() )
{
std::vector<cgsize_t> interfacecgns( 12 );
for (size_t i = 0; i < 12; i++)
interfacecgns[i] = cgsize_t(interface[i+1]);
int iConn;
std::string neigbourZoneName = GetGroupName(myMesh->ShapeToIndex(neighbourSolid),meshDim);
neigbourZoneName = neigbourZoneName.empty() ? "ZONESOLID" + std::to_string(myMesh->ShapeToIndex(neighbourSolid)) : neigbourZoneName;
std::string interfaceName = zoneName + "_" + neigbourZoneName + "_" + std::to_string(interface[0]);
if(cg_1to1_write(_fn, iBase, iZone, interfaceName.c_str(), neigbourZoneName.c_str(),
&interface[1], &interface[7], &interface[13], &iConn) != CG_OK) return addMessage(cg_get_error(), /*fatal = */true);
&interfacecgns[0], &interfacecgns[6], &interface[13], &iConn) != CG_OK) return addMessage(cg_get_error(), /*fatal = */true);
}
}
@ -399,12 +403,16 @@ Driver_Mesh::Status DriverStructuredCGNS_Write::Perform()
if ( !interface.empty() )
{
std::vector<cgsize_t> interfacecgns( 8 );
for (size_t i = 0; i < 8; i++)
interfacecgns[i] = cgsize_t(interface[i+1]);
int iConn;
std::string neigbourZoneName = GetGroupName(myMesh->ShapeToIndex(neighbourFace),meshDim);
neigbourZoneName = neigbourZoneName.empty() ? "ZONEFACE" + std::to_string(myMesh->ShapeToIndex(neighbourFace)) : neigbourZoneName;
std::string interfaceName = zoneName + "_" + neigbourZoneName + "_" + std::to_string(interface[0]);
if(cg_1to1_write(_fn, iBase, iZone, interfaceName.c_str(), neigbourZoneName.c_str(),
&interface[1], &interface[5], &interface[9], &iConn) != CG_OK) return addMessage(cg_get_error(), /*fatal = */true);
&interfacecgns[0], &interfacecgns[4], &interface[9], &iConn) != CG_OK) return addMessage(cg_get_error(), /*fatal = */true);
}
}

View File

@ -82,33 +82,12 @@ std::tuple<int,int,int> SMESH_RegularGrid::GetIJK(const int index) const
std::vector<int> SMESH_RegularGrid::getEdgeIndexLimitsInverted( const EdgeType edge ) const
{
auto limits = getEdgeIndexLimits( edge );
auto limits = getEdgeIndexLimits<int>( edge );
std::swap(limits[0],limits[2]);
std::swap(limits[1],limits[3]);
return limits;
}
std::vector<int> SMESH_RegularGrid::getEdgeIndexLimits( const EdgeType edge ) const
{
switch ( edge ) {
case EdgeType::BOTTOM:
return std::vector<int>{1,1,mnx,1};
break;
case EdgeType::RIGHT:
return std::vector<int>{mnx,1,mnx,mny};
break;
case EdgeType::TOP:
return std::vector<int>{mnx,mny,1,mny};
break;
case EdgeType::LEFT:
return std::vector<int>{1,mny,1,1};
break;
default:
return std::vector<int>{1,1,mnx,1};
break;
}
}
std::vector<int> SMESH_RegularGrid::getFaceIndexLimits( const int start, const int end ) const
{
auto startIJK = GetIJK(start);
@ -133,33 +112,6 @@ std::vector<int> SMESH_RegularGrid::getEdgeIndexLimits( const int start, const i
return std::vector<int>{iStart+1,jStart+1,iEnd+1,jEnd+1};
}
std::vector<int> SMESH_RegularGrid::getFaceIndexLimits( const FaceType face ) const
{
switch ( face ) {
case FaceType::B_BOTTOM:
return std::vector<int>{1,1,1,mnx,mny,1}; /*V0-V2*/
break;
case FaceType::B_RIGHT:
return std::vector<int>{mnx,1,1,mnx,mny,mnz}; /*V1-V6*/
break;
case FaceType::B_BACK:
return std::vector<int>{1,mny,1,mnx,mny,mnz}; /*V3-V6*/
break;
case FaceType::B_LEFT:
return std::vector<int>{1,1,1,1,mny,mnz}; /*V0-V7*/
break;
case FaceType::B_FRONT:
return std::vector<int>{1,1,1,mnx,1,mnz}; /*V0-V5*/
break;
case FaceType::B_TOP:
return std::vector<int>{1,1,mnz,mnx,mny,mnz}; /*V4-V6*/
break;
default:
return std::vector<int>{1,1,1,mnx,mny,1};
break;
}
}
int SMESH_RegularGrid::getEdgeSize( const EdgeType edge ) const
{
switch ( edge ) {
@ -199,22 +151,6 @@ int SMESH_RegularGrid::getFaceSize( const FaceType edge ) const
}
void SMESH_RegularGrid::getAllEdgeIndexLimits(std::vector<std::vector<int>>& allRanges)
{
this->foreachGridSide( [&]( EdgeType edge )
{
allRanges.push_back( getEdgeIndexLimits(edge) );
});
}
void SMESH_RegularGrid::getAllFaceIndexLimits(std::vector<std::vector<int>>& allRanges)
{
this->foreachGridFace( [&]( FaceType face )
{
allRanges.push_back( getFaceIndexLimits(face) );
});
}
std::vector<int> SMESH_RegularGrid::nodesOfFace( SMESH_RegularGrid::FaceType face ) const
{
size_t faceSize=0;
@ -452,8 +388,8 @@ void SMESH_RegularGrid::GetCommontInterface( FaceType face, SMESH_RegularGrid *
trueCorner[2] &&
trueCorner[3] ) /*Face to Face interface 100% conform*/
{
interfaceRange = this->getFaceIndexLimits( face );
interfaceDonor = grid->getFaceIndexLimits( gridFace );
interfaceRange = this->getFaceIndexLimits<int>( face );
interfaceDonor = grid->getFaceIndexLimits<int>( gridFace );
}
else if ( trueCorner[0] || trueCorner[1] ||
trueCorner[2] || trueCorner[3] ) /*Partial Face to Face. Only one intersection then all the other 3 vertex are: 2 in the edges 1 inside the face*/
@ -468,7 +404,7 @@ void SMESH_RegularGrid::GetCommontInterface( FaceType face, SMESH_RegularGrid *
{
if ( nodeToSearch->IsEqual( *sidePoint, tol ) )
{
interfaceRange = this->getFaceIndexLimits( face );
interfaceRange = this->getFaceIndexLimits<int>( face );
auto startIndex = foundTrueColum(0,trueTable) ? std::get<0>(neighboorVertex) :
foundTrueColum(2,trueTable) ? std::get<2>(neighboorVertex) :
@ -501,7 +437,7 @@ void SMESH_RegularGrid::GetCommontInterface( FaceType face, SMESH_RegularGrid *
this->getFaceIndexLimits( startIndex, nodeIndex) :
this->getFaceIndexLimits( nodeIndex, startIndex );
interfaceDonor = grid->getFaceIndexLimits( gridFace );
interfaceDonor = grid->getFaceIndexLimits<int>( gridFace );
return;
}
});
@ -542,7 +478,7 @@ void SMESH_RegularGrid::GetCommontInterface( EdgeType edge, SMESH_RegularGrid *
if ( (trueTable[0] || trueTable[1] ) && /*Case start-end vertex are coincident in both edges trivial*/
(trueTable[2] ||trueTable[3] ) )
{
interfaceRange = this->getEdgeIndexLimits( edge );
interfaceRange = this->getEdgeIndexLimits<int>( edge );
interfaceDonor = grid->getEdgeIndexLimitsInverted( gridEdge );
}
else if ( trueTable[0] || /*Case start OR end vertex are coincident in both edges*/
@ -559,7 +495,7 @@ void SMESH_RegularGrid::GetCommontInterface( EdgeType edge, SMESH_RegularGrid *
{
if ( nodeToSearch->IsEqual( *sidePoint, tol ) )
{
interfaceRange = this->getEdgeIndexLimits( edge );
interfaceRange = this->getEdgeIndexLimits<int>( edge );
auto startIndex = (trueTable[0] || trueTable[2]) ? neighboorVertex.first : neighboorVertex.second;
interfaceDonor = startIndex < nodeIndex ?
grid->getEdgeIndexLimits( startIndex, nodeIndex ) :
@ -658,7 +594,7 @@ void SMESH_RegularGrid::GetCommontInterface( EdgeType edge, SMESH_RegularGrid *
if ( startIndex != -1 && endIndex != -1 )
{
interfaceRange = this->getEdgeIndexLimits( edge );
interfaceRange = this->getEdgeIndexLimits<int>( edge );
interfaceDonor = grid->getEdgeIndexLimits( startIndex, endIndex );
}
}

View File

@ -27,14 +27,6 @@
//OCC
#include <Precision.hxx>
#include <NCollection_Array1.hxx>
//STD
#include <functional>
#include <memory>
#include "SMESH_Utils.hxx"
#include "SMDS_MeshNode.hxx"
#include <gp_Pnt.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
@ -42,9 +34,16 @@
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopoDS.hxx>
//STD
#include <functional>
#include <memory>
#include <vector>
#include <map>
#include "SMESH_Utils.hxx"
#include "SMDS_MeshNode.hxx"
class Adaptor3d_Surface;
class Adaptor2d_Curve2d;
class Adaptor3d_Curve;
@ -219,19 +218,23 @@ namespace SMESHUtils
void GetFaceInterfaces( SMESH_RegularGrid * grid, std::vector<int>& interface );
// \brief Fill the allRanges vector with the boundaries of the grid
void getAllEdgeIndexLimits( std::vector<std::vector<int>>& allRanges );
template<typename T>
void getAllEdgeIndexLimits( std::vector<std::vector<T>>& allRanges );
// \brief Fill the allRanges vector with the boundaries of the grid
void getAllFaceIndexLimits( std::vector<std::vector<int>>& allRanges );
template<typename T>
void getAllFaceIndexLimits( std::vector<std::vector<T>>& allRanges );
// \brief Get limits of the edge in the order (ibegin,jbegin,iend,jend)+1 because index in CGNS are not zero based
std::vector<int> getEdgeIndexLimits( const EdgeType edge ) const;
template<typename T>
std::vector<T> getEdgeIndexLimits( const EdgeType edge ) const;
// \brief Get limits of the edge in the order (iend,jend,ibegin,jbegin)+1 because index in CGNS are not zero based
std::vector<int> getEdgeIndexLimitsInverted( const EdgeType edge ) const;
// \brief Get limits of the face in the order (ibegin,jbegin,kbegin,iend,jend,kend)+1 because index in CGNS are not zero based
std::vector<int> getFaceIndexLimits( SMESH_RegularGrid::FaceType face ) const;
template<typename T>
std::vector<T> getFaceIndexLimits( SMESH_RegularGrid::FaceType face ) const;
// \brief Return the faceType to which the passed geometrical face belows to
SMESH_RegularGrid::FaceType getFaceTypeByGeomFace( TopoDS_Shape shapeFace ) const;

View File

@ -57,6 +57,74 @@ namespace SMESHUtils
for (auto node : nodesOfFace(face))
function(myCoordinates[node],node);
}
template<typename T>
std::vector<T> SMESH_RegularGrid::getEdgeIndexLimits( const EdgeType edge ) const
{
switch ( edge ) {
case EdgeType::BOTTOM:
return std::vector<T>{1,1,mnx,1};
break;
case EdgeType::RIGHT:
return std::vector<T>{mnx,1,mnx,mny};
break;
case EdgeType::TOP:
return std::vector<T>{mnx,mny,1,mny};
break;
case EdgeType::LEFT:
return std::vector<T>{1,mny,1,1};
break;
default:
return std::vector<T>{1,1,mnx,1};
break;
}
}
template<typename T>
std::vector<T> SMESH_RegularGrid::getFaceIndexLimits( const FaceType face ) const
{
switch ( face ) {
case FaceType::B_BOTTOM:
return std::vector<T>{1,1,1,mnx,mny,1}; /*V0-V2*/
break;
case FaceType::B_RIGHT:
return std::vector<T>{mnx,1,1,mnx,mny,mnz}; /*V1-V6*/
break;
case FaceType::B_BACK:
return std::vector<T>{1,mny,1,mnx,mny,mnz}; /*V3-V6*/
break;
case FaceType::B_LEFT:
return std::vector<T>{1,1,1,1,mny,mnz}; /*V0-V7*/
break;
case FaceType::B_FRONT:
return std::vector<T>{1,1,1,mnx,1,mnz}; /*V0-V5*/
break;
case FaceType::B_TOP:
return std::vector<T>{1,1,mnz,mnx,mny,mnz}; /*V4-V6*/
break;
default:
return std::vector<T>{1,1,1,mnx,mny,1};
break;
}
}
template<typename T>
void SMESH_RegularGrid::getAllEdgeIndexLimits(std::vector<std::vector<T>>& allRanges)
{
this->foreachGridSide( [&]( EdgeType edge )
{
allRanges.push_back( getEdgeIndexLimits<T>(edge) );
});
}
template<typename T>
void SMESH_RegularGrid::getAllFaceIndexLimits(std::vector<std::vector<T>>& allRanges)
{
this->foreachGridFace( [&]( FaceType face )
{
allRanges.push_back( getFaceIndexLimits<T>(face) );
});
}
}

View File

@ -93,7 +93,7 @@ bool testGetCommontInterface1D()
std::vector<int> interface; /* interface at right */
regularGrid0->GetEdgeInterfaces( regularGrid1.get(), interface );
std::vector<int> expectedRange = regularGrid0->getEdgeIndexLimits(SMESHUtils::SMESH_RegularGrid::RIGHT);
std::vector<int> expectedRange = regularGrid0->getEdgeIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::RIGHT);
std::vector<int> expectedDonorRange = regularGrid1->getEdgeIndexLimitsInverted(SMESHUtils::SMESH_RegularGrid::LEFT);
if ( interface.size() != 1+mny*2+2 )
@ -189,19 +189,19 @@ bool testGetCommontInterface2D()
regularGrid0->GetFaceInterfaces( regularGrid5.get(), interface[4] );
regularGrid0->GetFaceInterfaces( regularGrid6.get(), interface[5] );
expectedRange[0] = regularGrid0->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_BOTTOM);
expectedRange[1] = regularGrid0->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_RIGHT);
expectedRange[2] = regularGrid0->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_BACK);
expectedRange[3] = regularGrid0->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_LEFT);
expectedRange[4] = regularGrid0->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_FRONT);
expectedRange[5] = regularGrid0->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_TOP);
expectedRange[0] = regularGrid0->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_BOTTOM);
expectedRange[1] = regularGrid0->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_RIGHT);
expectedRange[2] = regularGrid0->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_BACK);
expectedRange[3] = regularGrid0->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_LEFT);
expectedRange[4] = regularGrid0->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_FRONT);
expectedRange[5] = regularGrid0->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_TOP);
expectedDonorRange[0] = regularGrid1->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_TOP);
expectedDonorRange[1] = regularGrid2->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_LEFT);
expectedDonorRange[2] = regularGrid3->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_FRONT );
expectedDonorRange[3] = regularGrid4->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_RIGHT);
expectedDonorRange[4] = regularGrid5->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_BACK);
expectedDonorRange[5] = regularGrid6->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_BOTTOM);
expectedDonorRange[0] = regularGrid1->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_TOP);
expectedDonorRange[1] = regularGrid2->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_LEFT);
expectedDonorRange[2] = regularGrid3->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_FRONT );
expectedDonorRange[3] = regularGrid4->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_RIGHT);
expectedDonorRange[4] = regularGrid5->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_BACK);
expectedDonorRange[5] = regularGrid6->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_BOTTOM);
int interfaceSize = 1+6*2+3;
for ( auto itf : interface )
@ -285,8 +285,8 @@ bool testGetPartialInterface2D()
expectedRange[0] = std::vector<int>({4,1,2,5,1,3});
expectedRange[1] = std::vector<int>({1,4,1,1,2,2});
expectedDonorRange[0] = regularGrid1->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_FRONT);
expectedDonorRange[1] = regularGrid2->getFaceIndexLimits(SMESHUtils::SMESH_RegularGrid::B_LEFT);
expectedDonorRange[0] = regularGrid1->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_FRONT);
expectedDonorRange[1] = regularGrid2->getFaceIndexLimits<int>(SMESHUtils::SMESH_RegularGrid::B_LEFT);
int interfaceSize = 1+6*2+3;
for ( auto itf : interface )