-// Copyright (C) 2007-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2023 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include "MEDFileFieldVisitor.hxx"
#include "MEDCouplingPartDefinition.hxx"
#include "MCAuto.txx"
+#include <numeric>
using namespace MEDCoupling;
const DataArrayDouble *coo(mesh->getCoords());
if(!coo)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null coords !");
- MCAuto<DataArrayInt> conn(zeStr->getConn());
+ MCAuto<DataArrayIdType> conn(zeStr->getConn());
if(conn.isNull())
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : null connectivity !");
conn->checkAllocated();
if(conn->getNumberOfComponents()!=1)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLInMesh : excepted to be single compo !");
- int nbCells(conn->getNumberOfTuples());
MCAuto<DataArrayDouble> connOut(coo->selectByTupleIdSafe(conn->begin(),conn->end()));
MCAuto<MEDCouplingUMesh> mcOut(MEDCouplingUMesh::Build0DMeshFromCoords(connOut));
mcOut->setName(BuildNewMeshName(mesh->getName(),MED_BALL_STR));
mOut->setMeshAtLevel(0,mcOut);
- const DataArrayInt *ff1(mesh->getFamilyFieldAtLevel(1));
+ const DataArrayIdType *ff1(mesh->getFamilyFieldAtLevel(1));
if(ff1)
{
- MCAuto<DataArrayInt> ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end()));
+ MCAuto<DataArrayIdType> ff1o(ff1->selectByTupleIdSafe(conn->begin(),conn->end()));
mOut->setFamilyFieldArr(1,ff1o);
}
- const DataArrayInt *nf1(mesh->getNumberFieldAtLevel(1));
+ const DataArrayIdType *nf1(mesh->getNumberFieldAtLevel(1));
if(nf1)
{
- MCAuto<DataArrayInt> nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end()));
+ MCAuto<DataArrayIdType> nf1o(nf1->selectByTupleIdSafe(conn->begin(),conn->end()));
mOut->setRenumFieldArr(1,nf1o);
}
MCAuto<MEDFileUMeshPerTypeCommon> md(zeStr->getMeshDef());
- const DataArrayInt *ff0(md->getFam());
+ const DataArrayIdType *ff0(md->getFam());
if(ff0)
- mOut->setFamilyFieldArr(0,const_cast<DataArrayInt *>(ff0));
- const DataArrayInt *nf0(md->getNum());
+ mOut->setFamilyFieldArr(0,const_cast<DataArrayIdType *>(ff0));
+ const DataArrayIdType *nf0(md->getNum());
if(nf0)
- mOut->setRenumFieldArr(0,const_cast<DataArrayInt *>(nf0));
+ mOut->setRenumFieldArr(0,const_cast<DataArrayIdType *>(nf0));
mOut->copyFamGrpMapsFrom(*mesh);
const std::vector< MCAuto<DataArray> >& vars(zeStr->getVars());
for(std::vector< MCAuto<DataArray> >::const_iterator it=vars.begin();it!=vars.end();it++)
std::vector<std::string> pfls(zeGuideForPfl->getPflsReallyUsed());
if(pfls.size()>=2)
throw INTERP_KERNEL::Exception("MEDFileBlowStrEltUp::dealWithMEDBALLSInFields : drink less coffee");
- MCAuto<DataArrayInt> pflMyLove;
+ MCAuto<DataArrayIdType> pflMyLove;
if(pfls.size()==1)
pflMyLove.takeRef(zeGuideForPfl->getProfile(pfls[0]));
// Yeah we have pfls
FieldWalker2(const MEDFileFieldPerMeshPerTypePerDisc *pmptpd);
std::string getLoc() const { return _loc; }
std::string getPfl() const { return _pfl; }
+ INTERP_KERNEL::NormalizedCellType getGeoType() const { return _ct; }
bool isClassic() const { return _is_classic; }
bool operator!=(const FieldWalker2& other) const;
bool operator==(const FieldWalker2& other) const;
private:
std::string _loc;
std::string _pfl;
+ INTERP_KERNEL::NormalizedCellType _ct;
bool _is_classic;
MCAuto<SlicePartDefinition> _pd;
};
private:
void checkUniqueLoc(const std::string& loc) const;
static MCAuto<DataArrayDouble> BuildMeshFromAngleVrille(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *angleDeVrille, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs);
+ static MCAuto<DataArrayDouble> BuildMeshFromEpaisseur(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *thickness, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs);
+ static MCAuto<DataArrayDouble> BuildMeshPipeSEG3(const DataArrayDouble *angle, const DataArrayDouble *scale, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs);
+ static MCAuto<DataArrayDouble> BuildMeshPipeSEG4(const DataArrayDouble *angle, const DataArrayDouble *scale, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs);
+ static MCAuto<MEDCouplingUMesh> BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto<DataArrayDouble>& ptsForLoc);
static MCAuto<DataArrayDouble> BuildMeshFromStructure(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs);
public:
static const char ANGLE_DE_VRILLE[];
+ static const char ANGLE[];
+ static const char SCALE[];
+ static const char EPAISSEUR[];
private:
std::vector<std::string> _locs;
std::vector<std::string> _pfl;
+ std::vector<INTERP_KERNEL::NormalizedCellType> _cts;
MCAuto<PartDefinition> _pd;
};
const char LocInfo::ANGLE_DE_VRILLE[]="ANGLE DE VRILLE";
+const char LocInfo::ANGLE[]="ANGLE";
+
+const char LocInfo::SCALE[]="SCALE";
+
+const char LocInfo::EPAISSEUR[]="EPAISSEUR";
+
LocInfo::LocInfo(const std::vector<FieldWalker2>& fw)
{
std::size_t sz(fw.size());
- _locs.resize(sz); _pfl.resize(sz);
+ _locs.resize(sz); _pfl.resize(sz); _cts.resize(sz);
if(sz>0)
_pd=fw[0].getPartDef()->deepCopy();
for(std::size_t i=0;i<sz;i++)
{
_locs[i]=fw[i].getLoc();
_pfl[i]=fw[i].getPfl();
+ _cts[i]=fw[i].getGeoType();
if(i>0)
_pd=(*_pd)+(*(fw[i].getPartDef()));
}
}
}
-MCAuto<DataArrayDouble> LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *angleDeVrille, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs)
+MCAuto<MEDCouplingUMesh> LocInfo::BuildMeshCommon(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs, MCAuto<DataArrayDouble>& ptsForLoc)
{
- MCAuto<DataArrayInt> conn(zeStr->getConn());
+ MCAuto<DataArrayIdType> conn(zeStr->getConn());
conn=conn->deepCopy(); conn->rearrange(1);
MCAuto<MEDCouplingUMesh> geoMesh;
{
geoMesh=umesh->buildUnstructured();
}
//
- MCConstAuto<DataArrayDouble> angleVrille;
if(!pfl.empty())
{
- const DataArrayInt *pflArr(globs->getProfile(pfl));
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
geoMesh=geoMesh->buildPartOfMySelf(pflArr->begin(),pflArr->end(),true);
- angleVrille=angleDeVrille->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
}
- else
- angleVrille.takeRef(angleDeVrille);
//
MCAuto<MEDCouplingFieldDouble> fakeF(MEDCouplingFieldDouble::New(ON_GAUSS_PT));
fakeF->setMesh(geoMesh);
- int nbg(loc.getGaussWeights().size());
fakeF->setGaussLocalizationOnType(gt,loc.getRefCoords(),loc.getGaussCoords(),loc.getGaussWeights());
- MCAuto<DataArrayDouble> ptsForLoc(fakeF->getLocalizationOfDiscr());
+ ptsForLoc=fakeF->getLocalizationOfDiscr();
+ //
+ return geoMesh;
+}
+
+MCAuto<DataArrayDouble> LocInfo::BuildMeshFromAngleVrille(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *angleDeVrille, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs)
+{
+ MCAuto<DataArrayDouble> ptsForLoc;
+ MCAuto<MEDCouplingUMesh> geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc));
+ //
+ MCConstAuto<DataArrayDouble> angleVrille;
+ if(!pfl.empty())
+ {
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
+ angleVrille=angleDeVrille->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
+ }
+ else
+ angleVrille.takeRef(angleDeVrille);
//
MCAuto<MEDCouplingFieldDouble> dir(geoMesh->buildDirectionVectorField());
MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
- int nbCells(geoMesh->getNumberOfCells()),nbCompo(ptsForLoc->getNumberOfComponents());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
- int nbSecPts(secPts->getNumberOfTuples());
+ mcIdType nbSecPts(secPts->getNumberOfTuples()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
{
const int TAB[3]={2,0,1};
- std::vector<int> v(TAB,TAB+3);
+ std::vector<std::size_t> v(TAB,TAB+3);
secPts=secPts->keepSelectedComponents(v);
}
const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
double ang1(M_PI/2.-rot->getIJ(j,1));
DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer());
DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,angleVrille->getIJ(j,0),nbSecPts,p->begin(),p->getPointer());
+ for(int l=0;l<nbg;l++)
+ {
+ MCAuto<DataArrayDouble> p2(p->deepCopy());
+ for(std::size_t k=0;k<nbCompo;k++)
+ p2->applyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k);
+ arrs[j*nbg+l]=p2;
+ }
+ }
+ std::vector<const DataArrayDouble *> arrs2(VecAutoToVecOfCstPt(arrs));
+ MCAuto<DataArrayDouble> resu(DataArrayDouble::Aggregate(arrs2));
+ return resu;
+}
+
+MCAuto<DataArrayDouble> LocInfo::BuildMeshFromEpaisseur(INTERP_KERNEL::NormalizedCellType gt, const DataArrayDouble *thickness, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs)
+{
+ MCAuto<DataArrayDouble> ptsForLoc;
+ MCAuto<MEDCouplingUMesh> geoMesh(BuildMeshCommon(gt,pfl,loc,zeStr,mesh,section,globs,ptsForLoc));
+ mcIdType nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
+ MCConstAuto<DataArrayDouble> zeThickness;
+ if(!pfl.empty())
+ {
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
+ zeThickness=thickness->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
+ }
+ else
+ zeThickness.takeRef(thickness);
+ MCAuto<DataArrayDouble> orthoArr;
+ {
+ MCAuto<MEDCouplingFieldDouble> ortho(geoMesh->buildOrthogonalField());
+ orthoArr.takeRef(ortho->getArray());
+ }
+ mcIdType nbCompo(ToIdType(orthoArr->getNumberOfComponents()));
+ MCAuto<DataArrayDouble> secPts(section->getCoords()->duplicateEachTupleNTimes(nbCompo));
+ secPts->rearrange(nbCompo);
+ std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
+ for(mcIdType j=0;j<nbCells;j++)
+ {
+ double thck(zeThickness->getIJ(j,0)),eccentricity(zeThickness->getIJ(j,1));
+ MCAuto<DataArrayDouble> fact(DataArrayDouble::New()),fact2(DataArrayDouble::New()); fact->alloc(1,nbCompo); fact2->alloc(1,nbCompo);
+ std::copy(orthoArr->begin()+j*nbCompo,orthoArr->begin()+(j+1)*nbCompo,fact->getPointer());
+ std::copy(orthoArr->begin()+j*nbCompo,orthoArr->begin()+(j+1)*nbCompo,fact2->getPointer());
+ std::for_each(fact2->rwBegin(),fact2->rwEnd(),[eccentricity](double& val){ val*=eccentricity; });
+ std::transform(fact->begin(),fact->end(),fact->getPointer(),[thck](const double& val){ return val*thck/2.; });
+ MCAuto<DataArrayDouble> p(DataArrayDouble::Multiply(secPts,fact));
+ p=DataArrayDouble::Add(p,fact2);
for(int l=0;l<nbg;l++)
{
MCAuto<DataArrayDouble> p2(p->deepCopy());
return resu;
}
+MCAuto<DataArrayDouble> LocInfo::BuildMeshPipeSEG3(const DataArrayDouble *angle, const DataArrayDouble *scale, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs)
+{
+ static const char MSG1[]="BuildMeshPipeSEG3 : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !";
+ MCAuto<DataArrayDouble> ptsForLoc;
+ MCAuto<MEDCouplingUMesh> geoMesh(BuildMeshCommon(INTERP_KERNEL::NORM_SEG3,pfl,loc,zeStr,mesh,section,globs,ptsForLoc));
+ mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
+ MCConstAuto<DataArrayDouble> zeAngle,zeScale;
+ if(!pfl.empty())
+ {
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
+ zeAngle=angle->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
+ zeScale=scale->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
+ }
+ else
+ {
+ zeAngle.takeRef(angle);
+ zeScale.takeRef(scale);
+ }
+ if(zeAngle->getNumberOfComponents()!=3 || zeScale->getNumberOfComponents()!=2 || nbg!=3)
+ throw INTERP_KERNEL::Exception(MSG1);
+ MCAuto<MEDCouplingFieldDouble> dir;
+ {
+ MCAuto<MEDCouplingUMesh> geoMesh2(geoMesh->deepCopy());
+ geoMesh2->convertQuadraticCellsToLinear();
+ dir=geoMesh2->buildDirectionVectorField();
+ }
+ MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
+ MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
+ {
+ const int TAB[3]={2,0,1};
+ std::vector<std::size_t> v(TAB,TAB+3);
+ secPts=secPts->keepSelectedComponents(v);
+ }
+ const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
+ double AX1[3]; AX1[2]=0.;
+ std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
+ for(mcIdType j=0;j<nbCells;j++)
+ {
+ constexpr int DIM=3;
+ MCAuto<DataArrayDouble> p(secPts->deepCopy());
+ double ang0(rot->getIJ(j,2));
+ double rmin(zeScale->getIJ(j,0)),rmax(zeScale->getIJ(j,1));
+ {
+ auto pt(p->rwBegin());
+ for(int i=0;i<nbSecPts;i++)
+ {
+ auto nrm(sqrt(std::accumulate(pt,pt+DIM,0.,[](double sum, double v) { return sum+v*v; } )));
+ auto sca((rmin+2.*(nrm-0.5)*(rmax-rmin))/nrm);
+ std::for_each(pt,pt+3,[sca](double& val) { val*=sca; } );
+ std::advance(pt,DIM);
+ }
+ }
+ DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer());
+ AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ
+ double ang1(M_PI/2.-rot->getIJ(j,1));
+ DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer());
+ for(int l=0;l<3;l++)
+ {
+ MCAuto<DataArrayDouble> p3(p->deepCopy());
+ DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,zeAngle->getIJ(j,l),nbSecPts,p3->begin(),p3->getPointer());
+ MCAuto<DataArrayDouble> p2(p3->deepCopy());
+ for(std::size_t k=0;k<nbCompo;k++)
+ p2->applyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k);
+ arrs[j*nbg+l]=p2;
+ }
+ }
+ std::vector<const DataArrayDouble *> arrs2(VecAutoToVecOfCstPt(arrs));
+ MCAuto<DataArrayDouble> resu(DataArrayDouble::Aggregate(arrs2));
+ return resu;
+}
+
+MCAuto<DataArrayDouble> LocInfo::BuildMeshPipeSEG4(const DataArrayDouble *angle, const DataArrayDouble *scale, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs)
+{
+ static const char MSG1[]="BuildMeshPipeSEG4 : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !";
+ MCAuto<DataArrayDouble> ptsForLoc;
+ MCAuto<MEDCouplingUMesh> geoMesh(BuildMeshCommon(INTERP_KERNEL::NORM_SEG4,pfl,loc,zeStr,mesh,section,globs,ptsForLoc));
+ mcIdType nbSecPts(section->getNumberOfNodes()),nbCells(geoMesh->getNumberOfCells()),nbg(ToIdType(loc.getGaussWeights().size()));
+ MCConstAuto<DataArrayDouble> zeAngle,zeScale;
+ if(!pfl.empty())
+ {
+ const DataArrayIdType *pflArr(globs->getProfile(pfl));
+ zeAngle=angle->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
+ zeScale=scale->selectByTupleIdSafe(pflArr->begin(),pflArr->end());
+ }
+ else
+ {
+ zeAngle.takeRef(angle);
+ zeScale.takeRef(scale);
+ }
+ if(zeAngle->getNumberOfComponents()!=4 || zeScale->getNumberOfComponents()!=2 || nbg!=3)
+ throw INTERP_KERNEL::Exception(MSG1);
+ MCAuto<MEDCouplingFieldDouble> dir;
+ {
+ MCAuto<MEDCouplingUMesh> geoMesh2(geoMesh->deepCopy());
+ geoMesh2->convertQuadraticCellsToLinear();
+ dir=geoMesh2->buildDirectionVectorField();
+ }
+ MCAuto<DataArrayDouble> rot(dir->getArray()->fromCartToSpher());
+ std::size_t nbCompo(ptsForLoc->getNumberOfComponents());
+ MCAuto<DataArrayDouble> secPts(section->getCoords()->changeNbOfComponents(nbCompo,0.));
+ {
+ const int TAB[3]={2,0,1};
+ std::vector<std::size_t> v(TAB,TAB+3);
+ secPts=secPts->keepSelectedComponents(v);
+ }
+ const double CENTER[3]={0.,0.,0.},AX0[3]={0.,0.,1.};
+ double AX1[3]; AX1[2]=0.;
+ std::vector< MCAuto<DataArrayDouble> > arrs(nbCells*nbg);
+ for(mcIdType j=0;j<nbCells;j++)
+ {
+ constexpr int DIM=3;
+ MCAuto<DataArrayDouble> p(secPts->deepCopy());
+ double ang0(rot->getIJ(j,2));
+ double rmin(zeScale->getIJ(j,0)),rmax(zeScale->getIJ(j,1));
+ {
+ auto pt(p->rwBegin());
+ for(int i=0;i<nbSecPts;i++)
+ {
+ auto nrm(sqrt(std::accumulate(pt,pt+DIM,0.,[](double sum, double v) { return sum+v*v; } )));
+ auto sca((rmin+2.*(nrm-0.5)*(rmax-rmin))/nrm);
+ std::for_each(pt,pt+3,[sca](double& val) { val*=sca; } );
+ std::advance(pt,DIM);
+ }
+ }
+ DataArrayDouble::Rotate3DAlg(CENTER,AX0,ang0,nbSecPts,p->begin(),p->getPointer());
+ AX1[0]=-sin(ang0); AX1[1]=cos(ang0);// rot Oy around OZ
+ double ang1(M_PI/2.-rot->getIJ(j,1));
+ DataArrayDouble::Rotate3DAlg(CENTER,AX1,-ang1,nbSecPts,p->begin(),p->getPointer());
+ for(int l=0;l<3;l++)
+ {
+ MCAuto<DataArrayDouble> p3(p->deepCopy());
+ DataArrayDouble::Rotate3DAlg(CENTER,dir->getArray()->begin()+j*3,zeAngle->getIJ(j,l),nbSecPts,p3->begin(),p3->getPointer());
+ MCAuto<DataArrayDouble> p2(p3->deepCopy());
+ for(std::size_t k=0;k<nbCompo;k++)
+ p2->applyLin(1.,ptsForLoc->getIJ(j*nbg+l,k),k);
+ arrs[j*nbg+l]=p2;
+ }
+ }
+ std::vector<const DataArrayDouble *> arrs2(VecAutoToVecOfCstPt(arrs));
+ MCAuto<DataArrayDouble> resu(DataArrayDouble::Aggregate(arrs2));
+ return resu;
+}
+
MCAuto<DataArrayDouble> LocInfo::BuildMeshFromStructure(INTERP_KERNEL::NormalizedCellType gt, const std::string& pfl, const MEDFileFieldLoc& loc, const MEDFileEltStruct4Mesh *zeStr, const MEDFileUMesh *mesh, const MEDFileUMesh *section, const MEDFileFieldGlobsReal *globs)
{
static const char MSG1[]="BuildMeshFromStructure : not recognized pattern ! Send mail to anthony.geay@edf.fr with corresponding MED file !";
const std::vector< MCAuto<DataArray> >& vars(zeStr->getVars());
- if(vars.size()!=1)
- throw INTERP_KERNEL::Exception(MSG1);
- MCAuto<DataArray> zeArr(vars[0]);
- if(zeArr.isNull())
- throw INTERP_KERNEL::Exception(MSG1);
- MCAuto<DataArrayDouble> zeArr2(DynamicCast<DataArray,DataArrayDouble>(zeArr));
- if(zeArr2.isNull())
- throw INTERP_KERNEL::Exception(MSG1);
- if(zeArr2->getName()!=ANGLE_DE_VRILLE)
- throw INTERP_KERNEL::Exception(MSG1);
- return BuildMeshFromAngleVrille(gt,zeArr2,pfl,loc,zeStr,mesh,section,globs);
+ if(vars.size()==1)
+ {
+ MCAuto<DataArray> zeArr(vars[0]);
+ if(zeArr.isNull())
+ throw INTERP_KERNEL::Exception(MSG1);
+ MCAuto<DataArrayDouble> zeArr2(DynamicCast<DataArray,DataArrayDouble>(zeArr));
+ if(zeArr2.isNull())
+ throw INTERP_KERNEL::Exception(MSG1);
+ if(zeArr2->getName()==ANGLE_DE_VRILLE || zeArr2->getName()==ANGLE)
+ return BuildMeshFromAngleVrille(gt,zeArr2,pfl,loc,zeStr,mesh,section,globs);
+ if(zeArr2->getName()==EPAISSEUR || zeArr2->getName()==SCALE)
+ return BuildMeshFromEpaisseur(gt,zeArr2,pfl,loc,zeStr,mesh,section,globs);
+ }
+ if(vars.size()==2)
+ {
+ MCAuto<DataArray> zeArr0(vars[0]),zeArr1(vars[1]);
+ if(zeArr0.isNull() || zeArr1.isNull())
+ throw INTERP_KERNEL::Exception(MSG1);
+ MCAuto<DataArrayDouble> zeArr00(DynamicCastSafe<DataArray,DataArrayDouble>(zeArr0)),zeArr11(DynamicCastSafe<DataArray,DataArrayDouble>(zeArr1));
+ MCAuto<DataArrayDouble> angle,scale;
+ if(zeArr00->getName()==ANGLE)
+ angle=zeArr00;
+ if(zeArr00->getName()==SCALE)
+ scale=zeArr00;
+ if(zeArr11->getName()==ANGLE)
+ angle=zeArr11;
+ if(zeArr11->getName()==SCALE)
+ scale=zeArr11;
+ if(angle.isNull() || scale.isNull())
+ throw INTERP_KERNEL::Exception(MSG1);
+ switch(gt)
+ {
+ case INTERP_KERNEL::NORM_SEG3:
+ {
+ return BuildMeshPipeSEG3(angle,scale,pfl,loc,zeStr,mesh,section,globs);
+ }
+ case INTERP_KERNEL::NORM_SEG4:
+ {
+ return BuildMeshPipeSEG4(angle,scale,pfl,loc,zeStr,mesh,section,globs);
+ }
+ default:
+ throw INTERP_KERNEL::Exception(MSG1);
+ }
+ }
+ throw INTERP_KERNEL::Exception(MSG1);
}
MCAuto<MEDFileUMesh> LocInfo::generateNonClassicalData(int zePos, const MEDFileUMesh *mesh, const MEDFileFieldGlobsReal *globs) const
throw INTERP_KERNEL::Exception("LocInfo::generateNonClassicalData : internal error !");
const MEDFileUMesh *meshLoc(gtk2->getMesh()),*section(gtk2->getSection());
const MEDFileStructureElement *se(gtk2->getSE());
- INTERP_KERNEL::NormalizedCellType gt;
+ MCAuto<MEDCouplingUMesh> um(meshLoc->getMeshAtLevel(0));
+ INTERP_KERNEL::NormalizedCellType gt(_cts[i]);
{
std::vector<int> nel(meshLoc->getNonEmptyLevels());
if(nel.size()!=1)
throw INTERP_KERNEL::Exception(MSG1);
if(nel[0]!=0)
throw INTERP_KERNEL::Exception(MSG1);
- MCAuto<MEDCouplingUMesh> um(meshLoc->getMeshAtLevel(0));
- if(um->getNumberOfCells()!=1)
+ mcIdType zePos(-1);
+ for(mcIdType icell = 0 ; icell < um->getNumberOfCells() ; ++icell)
+ if( gt == um->getTypeOfCell(icell) )
+ zePos = icell;
+ if(zePos == -1)
throw INTERP_KERNEL::Exception(MSG1);
- gt=um->getTypeOfCell(0);
- std::vector<int> v;
- um->getNodeIdsOfCell(0,v);
+ std::vector<mcIdType> v;
+ um->getNodeIdsOfCell(zePos,v);
std::size_t sz2(v.size());
for(std::size_t j=0;j<sz2;j++)
- if(v[j]!=j)
+ if(v[j]!=ToIdType(j))
throw INTERP_KERNEL::Exception(MSG1);
}
const std::vector< MCAuto<MEDFileEltStruct4Mesh> >& strs(mesh->getAccessOfUndergroundEltStrs());
{
_loc=pmptpd->getLocalization();
_pfl=pmptpd->getProfile();
+ _ct=pmptpd->getGeoTypeStatic();
_is_classic=pmptpd->getType()!=ON_GAUSS_PT;
_pd=SlicePartDefinition::New(pmptpd->getStart(),pmptpd->getEnd(),1);
}