checkCoherency1(eps);
}
-int MEDCouplingCMesh::getNumberOfCells() const
-{
- int ret=1;
- if(_x_array)
- ret*=_x_array->getNbOfElems()-1;
- if(_y_array)
- ret*=_y_array->getNbOfElems()-1;
- if(_z_array)
- ret*=_z_array->getNbOfElems()-1;
- return ret;
-}
-
-int MEDCouplingCMesh::getNumberOfNodes() const
-{
- int ret=1;
- if(_x_array)
- ret*=_x_array->getNbOfElems();
- if(_y_array)
- ret*=_y_array->getNbOfElems();
- if(_z_array)
- ret*=_z_array->getNbOfElems();
- return ret;
-}
-
void MEDCouplingCMesh::getSplitCellValues(int *res) const
{
int meshDim(getMeshDimension());
void MEDCouplingCMesh::getNodeGridStructure(int *res) const
{
- int spaceDim(getSpaceDimension());
- for(int i=0;i<spaceDim;i++)
- res[i]=getCoordsAt(i)->getNbOfElems();
+ std::vector<int> ret(getNodeGridStructure());
+ std::copy(ret.begin(),ret.end(),res);
}
std::vector<int> MEDCouplingCMesh::getNodeGridStructure() const
{
- std::vector<int> ret(getSpaceDimension());
- getNodeGridStructure(&ret[0]);
+ static const char MSG[]="MEDCouplingCMesh::getNodeGridStructure : mesh is invalid ! null vectors (X, Y or Z) must be put contiguously at the end !";
+ std::vector<int> ret;
+ bool isOK(true);
+ if(_x_array)
+ {
+ if(!_x_array->isAllocated() || _x_array->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : X array exits but it is not allocated or with nb of components equal to one !");
+ ret.push_back(_x_array->getNumberOfTuples());
+ }
+ else
+ isOK=false;
+ if(_y_array)
+ {
+ if(!_y_array->isAllocated() || _y_array->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : Y array exits but it is not allocated or with nb of components equal to one !");
+ if(!isOK)
+ throw INTERP_KERNEL::Exception(MSG);
+ ret.push_back(_y_array->getNumberOfTuples());
+ }
+ else
+ isOK=false;
+ if(_z_array)
+ {
+ if(!_z_array->isAllocated() || _z_array->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("MEDCouplingCMesh::getNodeGridStructure : Z array exits but it is not allocated or with nb of components equal to one !");
+ if(!isOK)
+ throw INTERP_KERNEL::Exception(MSG);
+ ret.push_back(_z_array->getNumberOfTuples());
+ }
return ret;
}
/*!
* Return the space dimension of \a this. It only considers the arrays along X, Y and Z to deduce that.
- * This method throws exceptions if the not null arrays defining this are not contiguouly at the end. For example X!=0,Y==0,Z!=0 will throw.
+ * This method throws exceptions if the not null arrays defining this are not contiguously at the end. For example X!=0,Y==0,Z!=0 will throw.
*/
int MEDCouplingCMesh::getSpaceDimension() const
{
- static const char MSG[]="MEDCouplingCMesh::getSpaceDimension : mesh is invalid ! null vectors (X, Y or Z) must be put contiguously at the end !";
- int ret(0);
- bool isOK(true);
- if(_x_array)
- ret++;
- else
- isOK=false;
- if(_y_array)
- {
- if(!isOK)
- throw INTERP_KERNEL::Exception(MSG);
- ret++;
- }
- else
- isOK=false;
- if(_z_array)
- {
- if(!isOK)
- throw INTERP_KERNEL::Exception(MSG);
- ret++;
- }
- return ret;
-}
-
-/*!
- * This method returns the mesh dimension of \a this. It can be different from space dimension in case of a not null dimension contains only one node.
- */
-int MEDCouplingCMesh::getMeshDimension() const
-{
- int ret(getSpaceDimension());
- if(_x_array)
- {
- if(_x_array->isAllocated())
- if(_x_array->getNumberOfTuples()==1)
- ret--;
- }
- if(_y_array)
- {
- if(_y_array->isAllocated())
- if(_y_array->getNumberOfTuples()==1)
- ret--;
- }
- if(_z_array)
- {
- if(_z_array->isAllocated())
- if(_z_array->getNumberOfTuples()==1)
- ret--;
- }
- return ret;
+ return (int)getNodeGridStructure().size();
}
void MEDCouplingCMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
MEDCOUPLING_EXPORT void checkCoherency() const;
MEDCOUPLING_EXPORT void checkCoherency1(double eps=1e-12) const;
MEDCOUPLING_EXPORT void checkCoherency2(double eps=1e-12) const;
- MEDCOUPLING_EXPORT int getNumberOfCells() const;
- MEDCOUPLING_EXPORT int getNumberOfNodes() const;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
- MEDCOUPLING_EXPORT int getMeshDimension() const;
MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
int MEDCouplingCurveLinearMesh::getNumberOfCells() const
{
checkCoherency();
- std::size_t nbOfCells=1,i=0;
- for(std::vector<int>::const_iterator it=_structure.begin();it!=_structure.end();it++,i++)
- nbOfCells*=(*it)-1;
- return (int)nbOfCells;
+ return MEDCouplingStructuredMesh::getNumberOfCells();
}
int MEDCouplingCurveLinearMesh::getNumberOfNodes() const
{
checkCoherency();
- std::size_t nbOfNodes=1;
- for(std::vector<int>::const_iterator it=_structure.begin();it!=_structure.end();it++)
- nbOfNodes*=(*it);
- return (int)nbOfNodes;
+ return MEDCouplingStructuredMesh::getNumberOfNodes();
}
void MEDCouplingCurveLinearMesh::getSplitCellValues(int *res) const
std::copy(_structure.begin(),_structure.end(),res);
}
+/*!
+ * MEDCouplingCurveLinearMesh has the property to define 2 space dimensions. One coming from its coordinates. The other coming from the node structure.
+ * Normally they should be equal ! This method returns the space dimension from coordinates. If the other one is requested call getSpaceDimensionOnNodeStruct.
+ *
+ * \sa MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct
+ */
int MEDCouplingCurveLinearMesh::getSpaceDimension() const
{
if(!((const DataArrayDouble *)_coords))
return _coords->getNumberOfComponents();
}
-int MEDCouplingCurveLinearMesh::getMeshDimension() const
-{
- return (int)_structure.size();
-}
-
void MEDCouplingCurveLinearMesh::getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const
{
if(!((const DataArrayDouble *)_coords))
MEDCOUPLING_EXPORT int getNumberOfCells() const;
MEDCOUPLING_EXPORT int getNumberOfNodes() const;
MEDCOUPLING_EXPORT int getSpaceDimension() const;
- MEDCOUPLING_EXPORT int getMeshDimension() const;
MEDCOUPLING_EXPORT void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
MEDCOUPLING_EXPORT std::string simpleRepr() const;
MEDCOUPLING_EXPORT std::string advancedRepr() const;
};
}
+/*!
+ * This method returns the mesh dimension of \a this. It can be different from space dimension in case of a not null dimension contains only one node.
+ */
+int MEDCouplingStructuredMesh::getMeshDimension() const
+{
+ std::vector<int> ngs(getNodeGridStructure());
+ int ret(0),pos(0);
+ for(std::vector<int>::const_iterator it=ngs.begin();it!=ngs.end();it++,pos++)
+ {
+ if(*it<=0)
+ {
+ std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getMeshDimension : At pos #" << pos << " number of nodes is " << *it << " ! Must be > 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(*it>1)
+ ret++;
+ }
+ return ret;
+}
+
+/*!
+ * This method returns the space dimension by only considering the node grid structure.
+ * For cartesian mesh the returned value is equal to those returned by getSpaceDimension.
+ * But for curvelinear is could be different !
+ */
+int MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct() const
+{
+ std::vector<int> nodeStr(getNodeGridStructure());
+ int spd1(0),pos(0);
+ for(std::vector<int>::const_iterator it=nodeStr.begin();it!=nodeStr.end();it++,pos++)
+ {
+ int elt(*it);
+ if(elt<=0)
+ {
+ std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getSpaceDimensionOnNodeStruct : At pos #" << pos << " value of node grid structure is " << *it << " ! must be >=1 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ spd1++;
+ }
+ return spd1;
+}
+
/*!
* This method returns the number of cells of unstructured sub level mesh, without building it.
*/
*/
MEDCoupling1SGTUMesh *MEDCouplingStructuredMesh::build1SGTUnstructured() const
{
- int meshDim(getMeshDimension());
- if(meshDim<0 || meshDim>3)
- throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTUnstructured : meshdim must be in [1,2,3] !");
+ int meshDim(getMeshDimension()),spaceDim(getSpaceDimensionOnNodeStruct());
+ if((meshDim<0 || meshDim>3) || (spaceDim<0 || spaceDim>3))
+ throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::build1SGTUnstructured : meshdim and spacedim must be in [1,2,3] !");
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> coords(getCoordinatesAndOwner());
int ns[3];
getNodeGridStructure(ns);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(Build1GTNodalConnectivity(ns,ns+meshDim));
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(Build1GTNodalConnectivity(ns,ns+spaceDim));
MEDCouplingAutoRefCountObjectPtr<MEDCoupling1SGTUMesh> ret(MEDCoupling1SGTUMesh::New(getName(),GetGeoTypeGivenMeshDimension(meshDim)));
ret->setNodalConnectivity(conn); ret->setCoords(coords);
return ret.retn();
*/
DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivity(const int *nodeStBg, const int *nodeStEnd)
{
- std::size_t dim(std::distance(nodeStBg,nodeStEnd));
+ int zippedNodeSt[3];
+ int dim(ZipNodeStructure(nodeStBg,nodeStEnd,zippedNodeSt));
switch(dim)
{
case 0:
return conn.retn();
}
case 1:
- return Build1GTNodalConnectivity1D(nodeStBg);
+ return Build1GTNodalConnectivity1D(zippedNodeSt);
case 2:
- return Build1GTNodalConnectivity2D(nodeStBg);
+ return Build1GTNodalConnectivity2D(zippedNodeSt);
case 3:
- return Build1GTNodalConnectivity3D(nodeStBg);
+ return Build1GTNodalConnectivity3D(zippedNodeSt);
default:
throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::Build1GTNodalConnectivity : only dimension in [0,1,2,3] supported !");
}
return conn.retn();
}
+/*!
+ * This method computes given the nodal structure defined by [ \a nodeStBg , \a nodeStEnd ) the zipped form.
+ * std::distance( \a nodeStBg, \a nodeStEnd ) is equal to the space dimension. The returned value is equal to
+ * the meshDimension (or the zipped spaceDimension).
+ *
+ * \param [out] zipNodeSt - The zipped node strucutre
+ * \return int - the
+ */
+int MEDCouplingStructuredMesh::ZipNodeStructure(const int *nodeStBg, const int *nodeStEnd, int zipNodeSt[3])
+{
+ int spaceDim((int)std::distance(nodeStBg,nodeStEnd));
+ if(spaceDim>3 || spaceDim<1)
+ throw INTERP_KERNEL::Exception("MEDCouplingStructuredMesh::ZipNodeStructure : spaceDim must in [1,2,3] !");
+ zipNodeSt[0]=0; zipNodeSt[1]=0; zipNodeSt[2]=0;
+ int zippedI(0);
+ for(int i=0;i<spaceDim;i++)
+ {
+ int elt(nodeStBg[i]);
+ if(elt<1)
+ {
+ std::ostringstream oss; oss << "MEDCouplingStructuredMesh::ZipNodeStructure : the input nodal structure at pos#" << i << "(" << nodeStBg[i] << ") is invalid !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(elt>=2)
+ zipNodeSt[zippedI++]=elt;
+ }
+ return zippedI;
+}
+
DataArrayInt *MEDCouplingStructuredMesh::Build1GTNodalConnectivityOfSubLevelMesh2D(const int *nodeStBg)
{
std::vector<int> ngs(2);
return std::accumulate(tmp,tmp+spaceDim,0);
}
+
+int MEDCouplingStructuredMesh::getNumberOfCells() const
+{
+ std::vector<int> ngs(getNodeGridStructure());
+ int ret(1);
+ bool isCatched(false);
+ std::size_t ii(0);
+ for(std::vector<int>::const_iterator it=ngs.begin();it!=ngs.end();it++,ii++)
+ {
+ int elt(*it);
+ if(elt<=0)
+ {
+ std::ostringstream oss; oss << "MEDCouplingStructuredMesh::getNumberOfCells : at pos #" << ii << " the number of nodes in nodeStructure is " << *it << " ! Must be > 0 !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+ }
+ if(elt>1)
+ {
+ ret*=elt-1;
+ isCatched=true;
+ }
+ }
+ return isCatched?ret:0;
+}
+
+int MEDCouplingStructuredMesh::getNumberOfNodes() const
+{
+ std::vector<int> ngs(getNodeGridStructure());
+ int ret(1);
+ for(std::vector<int>::const_iterator it=ngs.begin();it!=ngs.end();it++)
+ ret*=*it;
+ return ret;
+}
+
void MEDCouplingStructuredMesh::GetPosFromId(int nodeId, int meshDim, const int *split, int *res)
{
int work=nodeId;
MEDCOUPLING_EXPORT MEDCoupling1SGTUMesh *build1SGTSubLevelMesh() const;
MEDCOUPLING_EXPORT int getCellIdFromPos(int i, int j, int k) const;
MEDCOUPLING_EXPORT int getNodeIdFromPos(int i, int j, int k) const;
+ MEDCOUPLING_EXPORT int getNumberOfCells() const;
+ MEDCOUPLING_EXPORT int getNumberOfNodes() const;
+ MEDCOUPLING_EXPORT int getMeshDimension() const;
MEDCOUPLING_EXPORT int getNumberOfCellsOfSubLevelMesh() const;
+ MEDCOUPLING_EXPORT int getSpaceDimensionOnNodeStruct() const;
MEDCOUPLING_EXPORT virtual void getNodeGridStructure(int *res) const = 0;
MEDCOUPLING_EXPORT virtual void getSplitCellValues(int *res) const = 0;
MEDCOUPLING_EXPORT virtual void getSplitNodeValues(int *res) const = 0;
static DataArrayInt *Build1GTNodalConnectivity3D(const int *nodeStBg);
static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh2D(const int *nodeStBg);
static DataArrayInt *Build1GTNodalConnectivityOfSubLevelMesh3D(const int *nodeStBg);
+ protected:
+ static int ZipNodeStructure(const int *nodeStBg, const int *nodeStEnd, int zipNodeSt[3]);
protected:
MEDCOUPLING_EXPORT MEDCouplingStructuredMesh();
MEDCOUPLING_EXPORT MEDCouplingStructuredMesh(const MEDCouplingStructuredMesh& other, bool deepCpy);
cl.checkCoherency2()
li4=[sqrt(2.)*elt for elt in [1.,3.,5.,7.]]
li4_1=[0.5,0.5,2.5,2.5,6.5,6.5,12.5,12.5]
+ self.assertEqual(2,cl.getSpaceDimension())
+ self.assertEqual(1,cl.getMeshDimension())
+ self.assertEqual(4,cl.getNumberOfCells())
+ self.assertEqual(5,cl.getNumberOfNodes())
self.assertTrue(cl.getMeasureField(False).getArray().isEqual(DataArrayDouble(li4),1e-14))
self.assertTrue(cl.buildUnstructured().getMeasureField(False).getArray().isEqual(DataArrayDouble(li4),1e-14))
self.assertTrue(cl.getBarycenterAndOwner().isEqual(DataArrayDouble(li4_1,4,2),1e-14))
self.assertTrue(m.getBoundingBoxForBBTree().isEqual(DataArrayDouble([-0.5,0.5,-0.5,0.5,-0.5,0.5,-0.5,-0.31819805153394637],2,4),1e-12))
pass
+ def testSwig2CartBuildUnstructuredOnExoticCases1(self):
+ """ Test focusing on traduction from cartesian to unstructured mesh when spaceDim greater than meshDim.
+ """
+ #
+ m=MEDCouplingCMesh()
+ arrX=DataArrayDouble(3) ; arrX.iota()
+ arrY=DataArrayDouble(4) ; arrY.iota()
+ arrZ=DataArrayDouble(1) ; arrZ.iota()
+ m.setCoords(arrX,arrY,arrZ)
+ self.assertEqual(2,m.getMeshDimension())
+ self.assertEqual(3,m.getSpaceDimension())
+ mu=m.buildUnstructured()
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([4,1,0,3,4,4,2,1,4,5,4,4,3,6,7,4,5,4,7,8,4,7,6,9,10,4,8,7,10,11])))
+ self.assertTrue(mu.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30])))
+ coo0=DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(0,1,0),(1,1,0),(2,1,0),(0,2,0),(1,2,0),(2,2,0),(0,3,0),(1,3,0),(2,3,0)])
+ self.assertTrue(mu.getCoords().isEqual(coo0,1e-12))
+ mu.writeVTK("tutu.vtu")
+ #
+ m=MEDCouplingCMesh()
+ arrX=DataArrayDouble(3) ; arrX.iota()
+ arrY=DataArrayDouble(1) ; arrY.iota()
+ arrZ=DataArrayDouble(4) ; arrZ.iota()
+ m.setCoords(arrX,arrY,arrZ)
+ self.assertEqual(2,m.getMeshDimension())
+ self.assertEqual(3,m.getSpaceDimension())
+ mu=m.buildUnstructured()
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([4,1,0,3,4,4,2,1,4,5,4,4,3,6,7,4,5,4,7,8,4,7,6,9,10,4,8,7,10,11])))
+ self.assertTrue(mu.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30])))
+ coo1=DataArrayDouble([(0,0,0),(1,0,0),(2,0,0),(0,0,1),(1,0,1),(2,0,1),(0,0,2),(1,0,2),(2,0,2),(0,0,3),(1,0,3),(2,0,3)])
+ self.assertTrue(mu.getCoords().isEqual(coo1,1e-12))
+ #
+ m=MEDCouplingCMesh()
+ arrX=DataArrayDouble(1) ; arrX.iota() ; arrX+=9
+ arrY=DataArrayDouble(3) ; arrY.iota()
+ arrZ=DataArrayDouble(4) ; arrZ.iota()
+ m.setCoords(arrX,arrY,arrZ)
+ self.assertEqual(2,m.getMeshDimension())
+ self.assertEqual(3,m.getSpaceDimension())
+ mu=m.buildUnstructured()
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([4,1,0,3,4,4,2,1,4,5,4,4,3,6,7,4,5,4,7,8,4,7,6,9,10,4,8,7,10,11])))
+ self.assertTrue(mu.getNodalConnectivityIndex().isEqual(DataArrayInt([0,5,10,15,20,25,30])))
+ coo2=DataArrayDouble([(9,0,0),(9,1,0),(9,2,0),(9,0,1),(9,1,1),(9,2,1),(9,0,2),(9,1,2),(9,2,2),(9,0,3),(9,1,3),(9,2,3)])
+ self.assertTrue(mu.getCoords().isEqual(coo2,1e-12))
+ #
+ m=MEDCouplingCMesh()
+ arrX=DataArrayDouble(3) ; arrX.iota()
+ arrY=DataArrayDouble(1) ; arrY.iota(7)
+ arrZ=DataArrayDouble(1) ; arrZ.iota(8)
+ m.setCoords(arrX,arrY,arrZ)
+ self.assertEqual(1,m.getMeshDimension())
+ self.assertEqual(3,m.getSpaceDimension())
+ mu=m.buildUnstructured()
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([1,0,1,1,1,2])))
+ self.assertTrue(mu.getNodalConnectivityIndex().isEqual(DataArrayInt([0,3,6])))
+ coo3=DataArrayDouble([(0,7,8),(1,7,8),(2,7,8)])
+ self.assertTrue(mu.getCoords().isEqual(coo3,1e-12))
+ #
+ m=MEDCouplingCMesh()
+ arrX=DataArrayDouble(1) ; arrX.iota(7)
+ arrY=DataArrayDouble(1) ; arrY.iota(8)
+ arrZ=DataArrayDouble(3) ; arrZ.iota()
+ m.setCoords(arrX,arrY,arrZ)
+ self.assertEqual(1,m.getMeshDimension())
+ self.assertEqual(3,m.getSpaceDimension())
+ mu=m.buildUnstructured()
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([1,0,1,1,1,2])))
+ self.assertTrue(mu.getNodalConnectivityIndex().isEqual(DataArrayInt([0,3,6])))
+ coo4=DataArrayDouble([(7,8,0),(7,8,1),(7,8,2)])
+ self.assertTrue(mu.getCoords().isEqual(coo4,1e-12))
+ #
+ m=MEDCouplingCMesh()
+ arrX=DataArrayDouble(3) ; arrX.iota()
+ arrY=DataArrayDouble(1) ; arrY.iota(7)
+ m.setCoords(arrX,arrY)
+ self.assertEqual(1,m.getMeshDimension())
+ self.assertEqual(2,m.getSpaceDimension())
+ mu=m.buildUnstructured()
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([1,0,1,1,1,2])))
+ self.assertTrue(mu.getNodalConnectivityIndex().isEqual(DataArrayInt([0,3,6])))
+ coo5=DataArrayDouble([(0,7),(1,7),(2,7)])
+ self.assertTrue(mu.getCoords().isEqual(coo5,1e-12))
+ #
+ m=MEDCouplingCMesh()
+ arrX=DataArrayDouble(1) ; arrX.iota(7)
+ arrY=DataArrayDouble(3) ; arrY.iota()
+ m.setCoords(arrX,arrY)
+ self.assertEqual(1,m.getMeshDimension())
+ self.assertEqual(2,m.getSpaceDimension())
+ mu=m.buildUnstructured()
+ self.assertTrue(mu.getNodalConnectivity().isEqual(DataArrayInt([1,0,1,1,1,2])))
+ self.assertTrue(mu.getNodalConnectivityIndex().isEqual(DataArrayInt([0,3,6])))
+ coo6=DataArrayDouble([(7,0),(7,1),(7,2)])
+ self.assertTrue(mu.getCoords().isEqual(coo6,1e-12))
+ pass
+
def setUp(self):
pass
pass
int getCellIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
int getNodeIdFromPos(int i, int j, int k) const throw(INTERP_KERNEL::Exception);
int getNumberOfCellsOfSubLevelMesh() const throw(INTERP_KERNEL::Exception);
+ int getSpaceDimensionOnNodeStruct() const throw(INTERP_KERNEL::Exception);
virtual std::vector<int> getNodeGridStructure() const throw(INTERP_KERNEL::Exception);
std::vector<int> getCellGridStructure() const throw(INTERP_KERNEL::Exception);
MEDCoupling1SGTUMesh *build1SGTUnstructured() const throw(INTERP_KERNEL::Exception);
{
PyObject *buildVTUArrays() const throw(INTERP_KERNEL::Exception)
{
- bool isInternal;
+ bool isInternal;
std::vector< DataArrayDouble * > objs(self->buildVTUArrays(isInternal));
std::size_t sz(objs.size());
- PyObject *ret(PyTuple_New(2));
+ PyObject *ret(PyTuple_New(2));
PyObject *ret0=PyList_New(sz);
for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret0,i,SWIG_NewPointerObj(SWIG_as_voidptr(objs[i]),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,0,ret0);
- PyObject *ret1Py(isInternal?Py_True:Py_False);
- Py_XINCREF(ret1Py);
- PyTuple_SetItem(ret,1,ret1Py);
+ PyTuple_SetItem(ret,0,ret0);
+ PyObject *ret1Py(isInternal?Py_True:Py_False);
+ Py_XINCREF(ret1Py);
+ PyTuple_SetItem(ret,1,ret1Py);
return ret;
}
}
{
DataArrayDouble *ret0(0);
std::vector<int> ret1;
- bool ret2;
+ bool ret2;
self->buildVTUArrays(ret0,ret1,ret2);
std::size_t sz(ret1.size());
PyObject *ret=PyTuple_New(3);
for(std::size_t i=0;i<sz;i++)
PyList_SetItem(ret1Py,i,SWIG_From_int(ret1[i]));
PyTuple_SetItem(ret,1,ret1Py);
- PyObject *ret2Py(ret2?Py_True:Py_False);
- Py_XINCREF(ret2Py);
- PyTuple_SetItem(ret,2,ret2Py);
+ PyObject *ret2Py(ret2?Py_True:Py_False);
+ Py_XINCREF(ret2Py);
+ PyTuple_SetItem(ret,2,ret2Py);
return ret;
}
}
m1=MEDFileCurveLinearMesh(fname)
mm=m1.getMesh()
self.assertTrue(mm.isEqual(mesh,1e-12))
+ self.assertEqual(mm.getSpaceDimension(),3)
+ self.assertEqual(mm.getSpaceDimensionOnNodeStruct(),2)
#
m1=MEDFileMesh.New(fname)
self.assertTrue(isinstance(m1,MEDFileCurveLinearMesh))