From: Anthony Geay Date: Tue, 5 May 2015 15:10:55 +0000 (+0200) Subject: [EDF10718] : Diameter computation of non linear cells. X-Git-Tag: V7_6_0rc1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=44885a5d8fb477e4176a2886b8959df92f880e03;p=modules%2Fmed.git [EDF10718] : Diameter computation of non linear cells. --- diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index 7c01d990c..d3e364196 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -767,6 +767,58 @@ namespace INTERP_KERNEL } break; } + case NORM_TRI6: + { + switch(spaceDim) + { + case 2: + return new DiameterCalulatorTRI6S2; + case 3: + return new DiameterCalulatorTRI6S3; + default: + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For TRI6 only space dimension 2 and 3 implemented !"); + } + break; + } + case NORM_TRI7: + { + switch(spaceDim) + { + case 2: + return new DiameterCalulatorTRI7S2; + case 3: + return new DiameterCalulatorTRI7S3; + default: + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For TRI7 only space dimension 2 and 3 implemented !"); + } + break; + } + case NORM_QUAD8: + { + switch(spaceDim) + { + case 2: + return new DiameterCalulatorQUAD8S2; + case 3: + return new DiameterCalulatorQUAD8S3; + default: + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For QUAD8 only space dimension 2 and 3 implemented !"); + } + break; + } + case NORM_QUAD9: + { + switch(spaceDim) + { + case 2: + return new DiameterCalulatorQUAD9S2; + case 3: + return new DiameterCalulatorQUAD9S3; + default: + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For QUAD9 only space dimension 2 and 3 implemented !"); + } + break; + } case NORM_TETRA4: { if(spaceDim==3) @@ -774,6 +826,13 @@ namespace INTERP_KERNEL else throw Exception("CellModel::buildInstanceOfDiameterCalulator : For TETRA4 space dimension 3 expected !"); } + case NORM_TETRA10: + { + if(spaceDim==3) + return new DiameterCalulatorTETRA10; + else + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For TETRA10 space dimension 3 expected !"); + } case NORM_HEXA8: { if(spaceDim==3) @@ -781,6 +840,20 @@ namespace INTERP_KERNEL else throw Exception("CellModel::buildInstanceOfDiameterCalulator : For HEXA8 space dimension 3 expected !"); } + case NORM_HEXA20: + { + if(spaceDim==3) + return new DiameterCalulatorHEXA20; + else + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For HEXA20 space dimension 3 expected !"); + } + case NORM_HEXA27: + { + if(spaceDim==3) + return new DiameterCalulatorHEXA27; + else + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For HEXA27 space dimension 3 expected !"); + } case NORM_PENTA6: { if(spaceDim==3) @@ -788,6 +861,13 @@ namespace INTERP_KERNEL else throw Exception("CellModel::buildInstanceOfDiameterCalulator : For PENTA6 space dimension 3 expected !"); } + case NORM_PENTA15: + { + if(spaceDim==3) + return new DiameterCalulatorPENTA15; + else + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For PENTA15 space dimension 3 expected !"); + } case NORM_PYRA5: { if(spaceDim==3) @@ -795,6 +875,13 @@ namespace INTERP_KERNEL else throw Exception("CellModel::buildInstanceOfDiameterCalulator : For PYRA5 space dimension 3 expected !"); } + case NORM_PYRA13: + { + if(spaceDim==3) + return new DiameterCalulatorPYRA13; + else + throw Exception("CellModel::buildInstanceOfDiameterCalulator : For PYRA13 space dimension 3 expected !"); + } default: throw Exception("CellModel::buildInstanceOfDiameterCalulator : implemented only for TRI3, QUAD4, TETRA4, HEXA8, PENTA6, PYRA5 !"); } diff --git a/src/INTERP_KERNEL/DiameterCalculator.cxx b/src/INTERP_KERNEL/DiameterCalculator.cxx index a27395996..b89d66383 100644 --- a/src/INTERP_KERNEL/DiameterCalculator.cxx +++ b/src/INTERP_KERNEL/DiameterCalculator.cxx @@ -32,18 +32,44 @@ NormalizedCellType DiameterCalulatorTRI3S2::TYPE=NORM_TRI3; NormalizedCellType DiameterCalulatorTRI3S3::TYPE=NORM_TRI3; +NormalizedCellType DiameterCalulatorTRI6S2::TYPE=NORM_TRI6; + +NormalizedCellType DiameterCalulatorTRI6S3::TYPE=NORM_TRI6; + +NormalizedCellType DiameterCalulatorTRI7S2::TYPE=NORM_TRI7; + +NormalizedCellType DiameterCalulatorTRI7S3::TYPE=NORM_TRI7; + NormalizedCellType DiameterCalulatorQUAD4S2::TYPE=NORM_QUAD4; NormalizedCellType DiameterCalulatorQUAD4S3::TYPE=NORM_QUAD4; +NormalizedCellType DiameterCalulatorQUAD8S2::TYPE=NORM_QUAD8; + +NormalizedCellType DiameterCalulatorQUAD8S3::TYPE=NORM_QUAD8; + +NormalizedCellType DiameterCalulatorQUAD9S2::TYPE=NORM_QUAD9; + +NormalizedCellType DiameterCalulatorQUAD9S3::TYPE=NORM_QUAD9; + NormalizedCellType DiameterCalulatorTETRA4::TYPE=NORM_TETRA4; +NormalizedCellType DiameterCalulatorTETRA10::TYPE=NORM_TETRA10; + NormalizedCellType DiameterCalulatorHEXA8::TYPE=NORM_HEXA8; +NormalizedCellType DiameterCalulatorHEXA20::TYPE=NORM_HEXA20; + +NormalizedCellType DiameterCalulatorHEXA27::TYPE=NORM_HEXA27; + NormalizedCellType DiameterCalulatorPENTA6::TYPE=NORM_PENTA6; +NormalizedCellType DiameterCalulatorPENTA15::TYPE=NORM_PENTA15; + NormalizedCellType DiameterCalulatorPYRA5::TYPE=NORM_PYRA5; +NormalizedCellType DiameterCalulatorPYRA13::TYPE=NORM_PYRA13; + inline double SqNormV2(const double tab[2]) { return tab[0]*tab[0]+tab[1]*tab[1]; @@ -77,7 +103,7 @@ void ComputeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const { int offset(indPtr[*it]); if(connPtr[offset]==cti) - resPtr[*it]=evtor.computeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[(*it)+1],coordsPtr); + resPtr[*it]=evtor.ComputeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[(*it)+1],coordsPtr); else { std::ostringstream oss; oss << "DiameterCalculator::computeForListOfCellIdsUMeshFrmt : invalid nodal connectivity format at cell # " << *it << " !"; @@ -96,7 +122,7 @@ void ComputeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, c { int offset(indPtr[it]); if(connPtr[offset]==cti) - resPtr[it]=evtor.computeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[it+1],coordsPtr); + resPtr[it]=evtor.ComputeForOneCellInternal(connPtr+offset+1,connPtr+indPtr[it+1],coordsPtr); else { std::ostringstream oss; oss << "DiameterCalculator::computeForListOfCellIdsUMeshFrmt : invalid nodal connectivity format at cell # " << it << " !"; @@ -114,10 +140,12 @@ void ComputeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *co unsigned nbNodes(cm.getNumberOfNodes()); const int *ptr(connPtr); for(int i=0;i(nbOfCells,connPtr,coordsPtr,resPtr); } -double DiameterCalulatorTRI3S3::computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const +//================================================================= + +double DiameterCalulatorTRI3S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) { if(std::distance(bg,endd)==3) { @@ -163,7 +193,7 @@ double DiameterCalulatorTRI3S3::computeForOneCellInternal(const int *bg, const i return std::sqrt(res); } else - throw Exception("DiameterCalulatorTRI3S2::computeForOneCellInternal : input connectivity must be of size 3 !"); + throw Exception("DiameterCalulatorTRI3S2::ComputeForOneCellInternal : input connectivity must be of size 3 !"); } void DiameterCalulatorTRI3S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const @@ -181,7 +211,109 @@ void DiameterCalulatorTRI3S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int * ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } -double DiameterCalulatorQUAD4S2::computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const +//================================================================= + +double DiameterCalulatorTRI6S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==6) + return DiameterCalulatorTRI3S2::ComputeForOneCellInternal(bg,bg+3,coordsPtr); + else + throw Exception("DiameterCalulatorTRI6S2::ComputeForOneCellInternal : input connectivity must be of size 6 !"); +} + +void DiameterCalulatorTRI6S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTRI6S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTRI6S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorTRI6S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==6) + return DiameterCalulatorTRI3S3::ComputeForOneCellInternal(bg,bg+3,coordsPtr); + else + throw Exception("DiameterCalulatorTRI6S3::ComputeForOneCellInternal : input connectivity must be of size 6 !"); +} + +void DiameterCalulatorTRI6S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTRI6S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTRI6S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorTRI7S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==7) + return DiameterCalulatorTRI3S2::ComputeForOneCellInternal(bg,bg+3,coordsPtr); + else + throw Exception("DiameterCalulatorTRI7S2::ComputeForOneCellInternal : input connectivity must be of size 7 !"); +} + +void DiameterCalulatorTRI7S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTRI7S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTRI7S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorTRI7S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==7) + return DiameterCalulatorTRI3S3::ComputeForOneCellInternal(bg,bg+3,coordsPtr); + else + throw Exception("DiameterCalulatorTRI7S3::ComputeForOneCellInternal : input connectivity must be of size 7 !"); +} + +void DiameterCalulatorTRI7S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTRI7S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTRI7S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) { if(std::distance(bg,endd)==4) { @@ -192,7 +324,7 @@ double DiameterCalulatorQUAD4S2::computeForOneCellInternal(const int *bg, const return std::sqrt(std::max(SqNormV2(l0),SqNormV2(l1))); } else - throw Exception("DiameterCalulatorQUAD4S2::computeForOneCellInternal : input connectivity must be of size 4 !"); + throw Exception("DiameterCalulatorQUAD4S2::ComputeForOneCellInternal : input connectivity must be of size 4 !"); } void DiameterCalulatorQUAD4S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const @@ -210,7 +342,9 @@ void DiameterCalulatorQUAD4S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } -double DiameterCalulatorQUAD4S3::computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const +//================================================================= + +double DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) { if(std::distance(bg,endd)==4) { @@ -221,7 +355,7 @@ double DiameterCalulatorQUAD4S3::computeForOneCellInternal(const int *bg, const return std::sqrt(std::max(SqNormV3(l0),SqNormV3(l1))); } else - throw Exception("DiameterCalulatorQUAD4S3::computeForOneCellInternal : input connectivity must be of size 4 !"); + throw Exception("DiameterCalulatorQUAD4S3::ComputeForOneCellInternal : input connectivity must be of size 4 !"); } void DiameterCalulatorQUAD4S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const @@ -239,7 +373,109 @@ void DiameterCalulatorQUAD4S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } -double DiameterCalulatorTETRA4::computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const +//================================================================= + +double DiameterCalulatorQUAD8S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==8) + return DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(bg,bg+4,coordsPtr); + else + throw Exception("DiameterCalulatorQUAD8S2::ComputeForOneCellInternal : input connectivity must be of size 8 !"); +} + +void DiameterCalulatorQUAD8S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorQUAD8S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorQUAD8S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorQUAD8S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==8) + return DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(bg,bg+4,coordsPtr); + else + throw Exception("DiameterCalulatorQUAD8S3::ComputeForOneCellInternal : input connectivity must be of size 8 !"); +} + +void DiameterCalulatorQUAD8S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorQUAD8S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorQUAD8S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorQUAD9S2::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==9) + return DiameterCalulatorQUAD4S2::ComputeForOneCellInternal(bg,bg+4,coordsPtr); + else + throw Exception("DiameterCalulatorQUAD9S2::ComputeForOneCellInternal : input connectivity must be of size 9 !"); +} + +void DiameterCalulatorQUAD9S2::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorQUAD9S2::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorQUAD9S2::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorQUAD9S3::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==9) + return DiameterCalulatorQUAD4S3::ComputeForOneCellInternal(bg,bg+4,coordsPtr); + else + throw Exception("DiameterCalulatorQUAD8S3::ComputeForOneCellInternal : input connectivity must be of size 9 !"); +} + +void DiameterCalulatorQUAD9S3::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorQUAD9S3::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorQUAD9S3::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorTETRA4::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) { if(std::distance(bg,endd)==4) { @@ -256,7 +492,7 @@ double DiameterCalulatorTETRA4::computeForOneCellInternal(const int *bg, const i return std::sqrt(*std::max_element(tmp,tmp+6)); } else - throw Exception("DiameterCalulatorTETRA4::computeForOneCellInternal : input connectivity must be of size 4 !"); + throw Exception("DiameterCalulatorTETRA4::ComputeForOneCellInternal : input connectivity must be of size 4 !"); } void DiameterCalulatorTETRA4::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const @@ -274,7 +510,34 @@ void DiameterCalulatorTETRA4::computeFor1SGTUMeshFrmt(int nbOfCells, const int * ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } -double DiameterCalulatorHEXA8::computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const +//================================================================= + +double DiameterCalulatorTETRA10::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==10) + return DiameterCalulatorTETRA4::ComputeForOneCellInternal(bg,bg+4,coordsPtr); + else + throw Exception("DiameterCalulatorTETRA10::ComputeForOneCellInternal : input connectivity must be of size 10 !"); +} + +void DiameterCalulatorTETRA10::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTETRA10::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorTETRA10::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorHEXA8::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) { if(std::distance(bg,endd)==8) { @@ -289,7 +552,7 @@ double DiameterCalulatorHEXA8::computeForOneCellInternal(const int *bg, const in return std::sqrt(*std::max_element(tmp,tmp+4)); } else - throw Exception("DiameterCalulatorHEXA8::computeForOneCellInternal : input connectivity must be of size 8 !"); + throw Exception("DiameterCalulatorHEXA8::ComputeForOneCellInternal : input connectivity must be of size 8 !"); } void DiameterCalulatorHEXA8::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const @@ -307,7 +570,59 @@ void DiameterCalulatorHEXA8::computeFor1SGTUMeshFrmt(int nbOfCells, const int *c ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } -double DiameterCalulatorPENTA6::computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const +//================================================================= + +double DiameterCalulatorHEXA20::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==20) + return DiameterCalulatorHEXA8::ComputeForOneCellInternal(bg,bg+8,coordsPtr); + else + throw Exception("DiameterCalulatorHEXA20::ComputeForOneCellInternal : input connectivity must be of size 20 !"); +} + +void DiameterCalulatorHEXA20::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorHEXA20::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorHEXA20::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorHEXA27::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==27) + return DiameterCalulatorHEXA8::ComputeForOneCellInternal(bg,bg+8,coordsPtr); + else + throw Exception("DiameterCalulatorHEXA27::ComputeForOneCellInternal : input connectivity must be of size 27 !"); +} + +void DiameterCalulatorHEXA27::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorHEXA27::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorHEXA27::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorPENTA6::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) { if(std::distance(bg,endd)==6) { @@ -324,7 +639,7 @@ double DiameterCalulatorPENTA6::computeForOneCellInternal(const int *bg, const i return std::sqrt(*std::max_element(tmp,tmp+6)); } else - throw Exception("DiameterCalulatorPENTA6::computeForOneCellInternal : input connectivity must be of size 6 !"); + throw Exception("DiameterCalulatorPENTA6::ComputeForOneCellInternal : input connectivity must be of size 6 !"); } void DiameterCalulatorPENTA6::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const @@ -342,7 +657,34 @@ void DiameterCalulatorPENTA6::computeFor1SGTUMeshFrmt(int nbOfCells, const int * ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } -double DiameterCalulatorPYRA5::computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const +//================================================================= + +double DiameterCalulatorPENTA15::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==15) + return DiameterCalulatorPENTA6::ComputeForOneCellInternal(bg,bg+6,coordsPtr); + else + throw Exception("DiameterCalulatorPENTA15::ComputeForOneCellInternal : input connectivity must be of size 15 !"); +} + +void DiameterCalulatorPENTA15::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorPENTA15::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorPENTA15::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} + +//================================================================= + +double DiameterCalulatorPYRA5::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) { if(std::distance(bg,endd)==5) { @@ -359,7 +701,7 @@ double DiameterCalulatorPYRA5::computeForOneCellInternal(const int *bg, const in return std::sqrt(*std::max_element(tmp,tmp+6)); } else - throw Exception("DiameterCalulatorPYRA5::computeForOneCellInternal : input connectivity must be of size 5 !"); + throw Exception("DiameterCalulatorPYRA5::ComputeForOneCellInternal : input connectivity must be of size 5 !"); } void DiameterCalulatorPYRA5::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const @@ -376,3 +718,28 @@ void DiameterCalulatorPYRA5::computeFor1SGTUMeshFrmt(int nbOfCells, const int *c { ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); } + +//================================================================= + +double DiameterCalulatorPYRA13::ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) +{ + if(std::distance(bg,endd)==13) + return DiameterCalulatorPYRA5::ComputeForOneCellInternal(bg,bg+5,coordsPtr); + else + throw Exception("DiameterCalulatorPYRA13::ComputeForOneCellInternal : input connectivity must be of size 13 !"); +} + +void DiameterCalulatorPYRA13::computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForListOfCellIdsUMeshFrmt(bgIds,endIds,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorPYRA13::computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeForRangeOfCellIdsUMeshFrmt(bgId,endId,indPtr,connPtr,coordsPtr,resPtr); +} + +void DiameterCalulatorPYRA13::computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const +{ + ComputeFor1SGTUMeshFrmt(nbOfCells,connPtr,coordsPtr,resPtr); +} diff --git a/src/INTERP_KERNEL/DiameterCalculator.hxx b/src/INTERP_KERNEL/DiameterCalculator.hxx index 865e86682..a2a0a19f1 100644 --- a/src/INTERP_KERNEL/DiameterCalculator.hxx +++ b/src/INTERP_KERNEL/DiameterCalculator.hxx @@ -42,8 +42,8 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return computeForOneCellInternal(bg,endd,coordsPtr); } - double computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const; + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; @@ -55,8 +55,60 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return computeForOneCellInternal(bg,endd,coordsPtr); } - double computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const; + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorTRI6S2 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorTRI6S3 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorTRI7S2 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorTRI7S3 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; @@ -68,8 +120,8 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return computeForOneCellInternal(bg,endd,coordsPtr); } - double computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const; + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; @@ -81,8 +133,60 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return computeForOneCellInternal(bg,endd,coordsPtr); } - double computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const; + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorQUAD8S2 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorQUAD8S3 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorQUAD9S2 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorQUAD9S3 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; @@ -94,8 +198,21 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return computeForOneCellInternal(bg,endd,coordsPtr); } - double computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const; + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorTETRA10 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; @@ -107,8 +224,34 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return computeForOneCellInternal(bg,endd,coordsPtr); } - double computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const; + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorHEXA20 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorHEXA27 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; @@ -120,8 +263,21 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return computeForOneCellInternal(bg,endd,coordsPtr); } - double computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const; + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorPENTA15 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; @@ -133,8 +289,21 @@ namespace INTERP_KERNEL { public: NormalizedCellType getType() const { return TYPE; } - double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return computeForOneCellInternal(bg,endd,coordsPtr); } - double computeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr) const; + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); + void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; + void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; + public: + static NormalizedCellType TYPE; + }; + + class DiameterCalulatorPYRA13 : public DiameterCalculator + { + public: + NormalizedCellType getType() const { return TYPE; } + double computeForOneCell(const int *bg, const int *endd, const double *coordsPtr) const { return ComputeForOneCellInternal(bg,endd,coordsPtr); } + static double ComputeForOneCellInternal(const int *bg, const int *endd, const double *coordsPtr); void computeForListOfCellIdsUMeshFrmt(const int *bgIds, const int *endIds, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeForRangeOfCellIdsUMeshFrmt(int bgId, int endId, const int *indPtr, const int *connPtr, const double *coordsPtr, double *resPtr) const; void computeFor1SGTUMeshFrmt(int nbOfCells, const int *connPtr, const double *coordsPtr, double *resPtr) const; diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index 1675b5a8e..2b2e7da29 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -16502,12 +16502,20 @@ class MEDCouplingBasicsTest(unittest.TestCase): for c in [[0,1,2],[0,2,1],[2,1,0]]: m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],4.1,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],4.1,12) + m3=m.buildUnstructured() ; m3.convertLinearCellsToQuadratic(1) + self.assertAlmostEqual(m3.computeDiameterField().getArray()[0],4.1,12) # TRI3 - spacedim = 3 coo=DataArrayDouble([(1.3198537928820775,1.0991902391274959,-0.028645697595823361),(5.2486835106806335,2.2234012799688281,0.30368935050077939),(2.2973688139447361,3.1572023778066649,0.10937756365410012)]) m=MEDCoupling1SGTUMesh("mesh",NORM_TRI3) ; m.setCoords(coo) for c in [[0,1,2],[0,2,1],[2,1,0]]: m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],4.1,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],4.1,12) + m3=m.buildUnstructured() ; m3.convertLinearCellsToQuadratic(1) + self.assertAlmostEqual(m3.computeDiameterField().getArray()[0],4.1,12) # QUAD4 - spacedim = 2 coo=DataArrayDouble([(0,2),(2,0),(6,4),(4,9)]) m=MEDCoupling1SGTUMesh("mesh",NORM_QUAD4) ; m.setCoords(coo) @@ -16516,9 +16524,17 @@ class MEDCouplingBasicsTest(unittest.TestCase): c=[(elt+delta)%4 for elt in xrange(4)] m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp3,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp3,12) + m3=m.buildUnstructured() ; m3.convertLinearCellsToQuadratic(1) + self.assertAlmostEqual(m3.computeDiameterField().getArray()[0],exp3,12) c.reverse() m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp3,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp3,12) + m3=m.buildUnstructured() ; m3.convertLinearCellsToQuadratic(1) + self.assertAlmostEqual(m3.computeDiameterField().getArray()[0],exp3,12) # QUAD4 - spacedim = 3 coo=DataArrayDouble([(0.26570992384234871,2.0405889913271817,-0.079134238105786903),(2.3739976619218064,0.15779148692781009,0.021842842914139737),(6.1207841448393197,4.3755532938679655,0.43666375769970678),(3.8363255342943359,9.2521096041694229,0.41551170895942313)]) m=MEDCoupling1SGTUMesh("mesh",NORM_QUAD4) ; m.setCoords(coo) @@ -16526,9 +16542,17 @@ class MEDCouplingBasicsTest(unittest.TestCase): c=[(elt+delta)%4 for elt in xrange(4)] m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp3,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp3,12) + m3=m.buildUnstructured() ; m3.convertLinearCellsToQuadratic(1) + self.assertAlmostEqual(m3.computeDiameterField().getArray()[0],exp3,12) c.reverse() m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp3,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp3,12) + m3=m.buildUnstructured() ; m3.convertLinearCellsToQuadratic(1) + self.assertAlmostEqual(m3.computeDiameterField().getArray()[0],exp3,12) # PENTA6 # noise of coo=DataArrayDouble([(0,0,0),(1,0,0),(0,1,0),(0,0,2),(1,0,2),(0,1,2)]) + rotation([0.7,-1.2,0.6],[-4,-1,10],0.3) coo=DataArrayDouble([(-0.28594726851554486,-0.23715005500928255,-0.10268080010083136),(0.6167364988633947,-0.008923258436324799,-0.08574087516687756),(-0.6132873463333834,0.6943403970881654,-0.2806118260037991),(-0.40705974936532896,-0.05868487929989308,1.7724055544436323),(0.5505955507861958,0.19145393798144705,1.8788156352163994),(-0.6092686217773406,0.812502961290914,1.685712743757831)]) @@ -16540,9 +16564,13 @@ class MEDCouplingBasicsTest(unittest.TestCase): c+=[elt+3 for elt in c] m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp4,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp4,12) c.reverse() m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp4,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp4,12) # HEXA8 # noise of coo=DataArrayDouble([(0,0,0),(1,0,0),(1,1,0),(0,1,0),(0,0,2),(1,0,2),(1,1,2),(0,1,2)]) + rotation([0.7,-1.2,0.6],[-4,-1,10],0.3) coo=DataArrayDouble([(-0.21266406388867243,-0.3049569460042527,-0.11012394815006032),(0.7641037943272584,-0.06990814759929553,-0.0909613877456491),(0.47406560768559974,0.8681310650341907,-0.2577311403703061),(-0.5136830410871793,0.644390554940524,-0.21319015989794698),(-0.4080167737381202,-0.12853761670628505,1.7869166291979348),(0.5650318811550441,0.20476257733110748,1.8140158890821603),(0.3230844436386215,1.1660778242678538,1.7175073141333406),(-0.6656588358432984,0.918357550969698,1.7566470691880265)]) @@ -16554,9 +16582,13 @@ class MEDCouplingBasicsTest(unittest.TestCase): c+=[elt+4 for elt in c] m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp5,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp5,12) c.reverse() m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp5,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp5,12) # PYRA5 (1) 5th node is further # noise of coo=DataArrayDouble([(0,0,0),(1,0,0),(1,1,0),(0,1,0),(0.5,0.5,2)]) + rotation([0.7,-1.2,0.6],[-4,-1,10],0.3) coo=DataArrayDouble([(-0.31638393672228626,-0.3157865246451914,-0.12555467233075002),(0.7281379795666488,0.03836511217237115,-0.08431662762197323),(0.4757967840735147,0.8798897996143908,-0.2680890320119049),(-0.5386339871809047,0.5933159894201252,-0.2975311238319419),(0.012042592988768974,0.534282135495012,1.7859521682027926)]) @@ -16568,6 +16600,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): c+=[4] m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp6,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp6,12) pass # PYRA5 (2) 5th node is closer # noise of coo=DataArrayDouble([(0,0,0),(1,0,0),(1,1,0),(0,1,0),(0.5,0.5,0.1)]) + rotation([0.7,-1.2,0.6],[-4,-1,10],0.3) @@ -16580,6 +16614,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): c+=[4] m.setNodalConnectivity(DataArrayInt(c)) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp7,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp7,12) pass # TETRA4 # noise of coo=DataArrayDouble([(0,0,0),(1,0,0),(0,1,0),(1,1,1)]) + rotation([0.7,-1.2,0.6],[-4,-1,10],0.3) @@ -16591,6 +16627,8 @@ class MEDCouplingBasicsTest(unittest.TestCase): for i in xrange(4): m.setNodalConnectivity(DataArrayInt([(elt+i)%4 for elt in c])) self.assertAlmostEqual(m.computeDiameterField().getArray()[0],exp8,12) + m2=m.buildUnstructured() ; m2.convertLinearCellsToQuadratic(0) + self.assertAlmostEqual(m2.computeDiameterField().getArray()[0],exp8,12) pass pass pass