X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FMEDCoupling%2FMEDCouplingNormalizedUnstructuredMesh.txx;h=eb9d2325de5582a81f0b444a80d15d03b6904e75;hb=0c9d48870957c4a9f6f82fc8e2c569780a5f886b;hp=95d74e589ad0f580ce83a3f18b3e5e69f4a4854b;hpb=1d6ada792c6edd03343d9ee09326ef0c43d00cdc;p=modules%2Fmed.git diff --git a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx index 95d74e589..eb9d2325d 100644 --- a/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx +++ b/src/MEDCoupling/MEDCouplingNormalizedUnstructuredMesh.txx @@ -17,18 +17,20 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // Author : Anthony Geay (CEA/DEN) + #ifndef __MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_TXX__ #define __MEDCOUPLINGNORMALIZEDUNSTRUCTUREDMESH_TXX__ #include "MEDCouplingNormalizedUnstructuredMesh.hxx" #include "MEDCouplingUMesh.hxx" +#include "MEDCoupling1GTUMesh.hxx" #include "MEDCouplingMemArray.hxx" #include template -MEDCouplingNormalizedUnstructuredMesh::MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingUMesh *mesh):_mesh(mesh) +MEDCouplingNormalizedUnstructuredMesh::MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingPointSet *mesh):_mesh(mesh) { if(_mesh) _mesh->incrRef(); @@ -122,24 +124,53 @@ MEDCouplingNormalizedUnstructuredMesh::~MEDCouplingNormalizedU template void MEDCouplingNormalizedUnstructuredMesh::prepare() { - int nbOfCell=_mesh->getNumberOfCells(); - int initialConnSize=_mesh->getNodalConnectivity()->getNbOfElems(); - _conn_for_interp=new int[initialConnSize-nbOfCell]; - _conn_index_for_interp=new int[nbOfCell+1]; - _conn_index_for_interp[0]=0; - const int *work_conn=_mesh->getNodalConnectivity()->getConstPointer()+1; - const int *work_conn_index=_mesh->getNodalConnectivityIndex()->getConstPointer(); - int *work_conn_for_interp=_conn_for_interp; - int *work_conn_index_for_interp=_conn_index_for_interp; - for(int i=0;i(_mesh)); + if(m1) + { + int nbOfCell=m1->getNumberOfCells(); + int initialConnSize=m1->getNodalConnectivity()->getNbOfElems(); + _conn_for_interp=new int[initialConnSize-nbOfCell]; + _conn_index_for_interp=new int[nbOfCell+1]; + _conn_index_for_interp[0]=0; + const int *work_conn=m1->getNodalConnectivity()->getConstPointer()+1; + const int *work_conn_index=m1->getNodalConnectivityIndex()->getConstPointer(); + int *work_conn_for_interp=_conn_for_interp; + int *work_conn_index_for_interp=_conn_index_for_interp; + for(int i=0;i(_mesh)); + if(m2) + { + int nbOfCell(m2->getNumberOfCells()); + _conn_index_for_interp=new int[nbOfCell+1]; + const int *conni(m2->getNodalConnectivityIndex()->begin()); + std::copy(conni,conni+nbOfCell+1,_conn_index_for_interp); + _conn_for_interp=new int[m2->getNodalConnectivity()->getNumberOfTuples()]; + std::copy(m2->getNodalConnectivity()->begin(),m2->getNodalConnectivity()->end(),_conn_for_interp); + return ; + } + const ParaMEDMEM::MEDCoupling1SGTUMesh *m3(dynamic_cast(_mesh)); + if(m3) { - int nbOfValsToCopy=work_conn_index[1]-work_conn_index[0]-1; - work_conn_for_interp=std::copy(work_conn,work_conn+nbOfValsToCopy,work_conn_for_interp); - work_conn_index_for_interp[1]=work_conn_index_for_interp[0]+nbOfValsToCopy; - work_conn_index++; - work_conn+=nbOfValsToCopy+1; - work_conn_index_for_interp++; + int nbOfCell(m3->getNumberOfCells()),nbNodesPerCell(m3->getNumberOfNodesPerCell()); + _conn_index_for_interp=new int[nbOfCell+1]; _conn_index_for_interp[0]=0; + int *work(_conn_index_for_interp); + for(int i=0;igetNodalConnectivity()->getNumberOfTuples()]; + std::copy(m3->getNodalConnectivity()->begin(),m3->getNodalConnectivity()->end(),_conn_for_interp); + return ; } + throw INTERP_KERNEL::Exception("MEDCouplingNormalizedUnstructuredMesh::prepare : Unrecognized unstructured mesh ! Type must be in MEDCouplingUMesh, MEDCoupling1DGTUMesh, MEDCoupling1SGTUMesh !"); } #endif