return nbOfTuples/nbOfNodesPerCell;
}
+int MEDCoupling1SGTUMesh::getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception)
+{
+ return getNumberOfNodesPerCell();
+}
+
int MEDCoupling1SGTUMesh::getNumberOfNodesPerCell() const throw(INTERP_KERNEL::Exception)
{
checkNonDynamicGeoType();
void MEDCoupling1DGTUMesh::getNodeIdsOfCell(int cellId, std::vector<int>& conn) const
{
- int nbOfCells=getNumberOfCells();//performs checks
+ int nbOfCells(getNumberOfCells());//performs checks
if(cellId>=0 && cellId<nbOfCells)
{
int strt=_conn_indx->getIJ(cellId,0),stp=_conn_indx->getIJ(cellId+1,0);
}
else
{
- std::ostringstream oss; oss << "MEDCoupling1SGTUMesh::getNodeIdsOfCell : request for cellId #" << cellId << " must be in [0," << nbOfCells << ") !";
+ std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::getNodeIdsOfCell : request for cellId #" << cellId << " must be in [0," << nbOfCells << ") !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+}
+
+int MEDCoupling1DGTUMesh::getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception)
+{
+ int nbOfCells(getNumberOfCells());//performs checks
+ if(cellId>=0 && cellId<nbOfCells)
+ return _conn_indx->getIJ(cellId+1,0)-_conn_indx->getIJ(cellId,0);
+ else
+ {
+ std::ostringstream oss; oss << "MEDCoupling1DGTUMesh::getNumberOfNodesInCell : request for cellId #" << cellId << " must be in [0," << nbOfCells << ") !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N);
MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const;
+ MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
// overload of MEDCoupling1GTUMesh
MEDCOUPLING_EXPORT void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N);
MEDCOUPLING_EXPORT void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const;
+ MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
// overload of MEDCoupling1GTUMesh
MEDCOUPLING_EXPORT void checkCoherencyOfConnectivity() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void allocateCells(int nbOfCells=0) throw(INTERP_KERNEL::Exception);
namespace ParaMEDMEM
{
- class MEDCouplingUMesh;
+ class MEDCouplingPointSet;
}
template<int SPACEDIM,int MESHDIM>
typedef int MyConnType;
static const INTERP_KERNEL::NumberingPolicy My_numPol=INTERP_KERNEL::ALL_C_MODE;
public:
- MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingUMesh *mesh);
+ MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingPointSet *mesh);
void getBoundingBox(double *boundingBox) const;
INTERP_KERNEL::NormalizedCellType getTypeOfElement(int eltId) const;
int getNumberOfNodesOfElement(int eltId) const;
private:
void prepare();
private:
- const ParaMEDMEM::MEDCouplingUMesh *_mesh;
+ const ParaMEDMEM::MEDCouplingPointSet *_mesh;
int *_conn_for_interp;
int *_conn_index_for_interp;
};
// 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 <limits>
template<int SPACEDIM,int MESHDIM>
-MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingUMesh *mesh):_mesh(mesh)
+MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::MEDCouplingNormalizedUnstructuredMesh(const ParaMEDMEM::MEDCouplingPointSet *mesh):_mesh(mesh)
{
if(_mesh)
_mesh->incrRef();
template<int SPACEDIM,int MESHDIM>
void MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::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<nbOfCell;i++)
+ const ParaMEDMEM::MEDCouplingUMesh *m1(dynamic_cast<const ParaMEDMEM::MEDCouplingUMesh *>(_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<nbOfCell;i++)
+ {
+ 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++;
+ }
+ return ;
+ }
+ const ParaMEDMEM::MEDCoupling1DGTUMesh *m2(dynamic_cast<const ParaMEDMEM::MEDCoupling1DGTUMesh *>(_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<const ParaMEDMEM::MEDCoupling1SGTUMesh *>(_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;i<nbOfCell;i++,work++)
+ work[1]=work[0]+nbNodesPerCell;
+ _conn_for_interp=new int[m3->getNodalConnectivity()->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
virtual MEDCouplingPointSet *buildFacePartOfMySelfNode(const int *start, const int *end, bool fullyIn) const = 0;
virtual DataArrayInt *findBoundaryNodes() const = 0;
virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const = 0;
+ virtual int getNumberOfNodesInCell(int cellId) const = 0;
virtual DataArrayInt *getNodeIdsInUse(int& nbrOfNodesInUse) const throw(INTERP_KERNEL::Exception) = 0;
virtual void fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const = 0;
virtual void renumberNodesInConn(const int *newNodeNumbersO2N) = 0;
int meshInterpType=((int)_src_ft->getMesh()->getType()*16)+(int)_target_ft->getMesh()->getType();
switch(meshInterpType)
{
+ case 90:
+ case 91:
+ case 165:
+ case 181:
+ case 170:
+ case 171:
+ case 186:
+ case 187:
case 85://Unstructured-Unstructured
return prepareInterpKernelOnlyUU();
+ case 167:
+ case 183:
case 87://Unstructured-Cartesian
return prepareInterpKernelOnlyUC();
+ case 122:
+ case 123:
case 117://Cartesian-Unstructured
return prepareInterpKernelOnlyCU();
case 119://Cartesian-Cartesian
int MEDCouplingRemapper::prepareInterpKernelOnlyUU() throw(INTERP_KERNEL::Exception)
{
- const MEDCouplingUMesh *src_mesh=static_cast<const MEDCouplingUMesh *>(_src_ft->getMesh());
- const MEDCouplingUMesh *target_mesh=static_cast<const MEDCouplingUMesh *>(_target_ft->getMesh());
+ const MEDCouplingPointSet *src_mesh=static_cast<const MEDCouplingPointSet *>(_src_ft->getMesh());
+ const MEDCouplingPointSet *target_mesh=static_cast<const MEDCouplingPointSet *>(_target_ft->getMesh());
std::string srcMeth,trgMeth;
std::string method=checkAndGiveInterpolationMethodStr(srcMeth,trgMeth);
const int srcMeshDim=src_mesh->getMeshDimension();
{
stream << "MEDCouplingUMeshDesc C++ instance at " << this << ". Name : \"" << getName() << "\".";
}
+
+int MEDCouplingUMeshDesc::getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception)
+{
+ throw INTERP_KERNEL::Exception("MEDCouplingUMeshDesc::getNumberOfNodesInCell : not implemented yet !");
+}
MEDCOUPLING_EXPORT DataArrayInt *computeEffectiveNbOfNodesPerCell() const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
+ MEDCOUPLING_EXPORT int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
MEDCOUPLING_EXPORT MEDCouplingMeshType getType() const { return UNSTRUCTURED_DESC; }
virtual void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception);
static DataArrayDouble *MergeNodesArray(const MEDCouplingPointSet *m1, const MEDCouplingPointSet *m2) throw(INTERP_KERNEL::Exception);
static MEDCouplingPointSet *BuildInstanceFromMeshType(MEDCouplingMeshType type) throw(INTERP_KERNEL::Exception);
+ virtual int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
virtual MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *getCellsInBoundingBox(const INTERP_KERNEL::DirectedBoundingBox& bbox, double eps) throw(INTERP_KERNEL::Exception);
virtual DataArrayInt *zipCoordsTraducer() throw(INTERP_KERNEL::Exception);
void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true) throw(INTERP_KERNEL::Exception);
INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const throw(INTERP_KERNEL::Exception);
void setPartOfMySelf2(int start, int end, int step, const MEDCouplingUMesh& otherOnSameCoordsThanThis) throw(INTERP_KERNEL::Exception);
- int getNumberOfNodesInCell(int cellId) const throw(INTERP_KERNEL::Exception);
int getMeshLength() const throw(INTERP_KERNEL::Exception);
void computeTypes() throw(INTERP_KERNEL::Exception);
std::string reprConnectivityOfThis() const throw(INTERP_KERNEL::Exception);