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);
}
}
grid->GetEdgeInterfaces(myMesh->GetTheGrid(neighbourFace).get(), interface);
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);
}
}
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);
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 ) {
}
-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;
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*/
{
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) :
this->getFaceIndexLimits( startIndex, nodeIndex) :
this->getFaceIndexLimits( nodeIndex, startIndex );
- interfaceDonor = grid->getFaceIndexLimits( gridFace );
+ interfaceDonor = grid->getFaceIndexLimits<int>( gridFace );
return;
}
});
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*/
{
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 ) :
if ( startIndex != -1 && endIndex != -1 )
{
- interfaceRange = this->getEdgeIndexLimits( edge );
+ interfaceRange = this->getEdgeIndexLimits<int>( edge );
interfaceDonor = grid->getEdgeIndexLimits( startIndex, endIndex );
}
}
//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>
#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;
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;
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) );
+ });
+ }
}
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 )
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);
-
- 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);
+ 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<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 )
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 )