-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <sstream>
#include <numeric>
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
MEDCouplingIMesh::MEDCouplingIMesh():_space_dim(-1)
{
MEDCouplingIMesh *MEDCouplingIMesh::New(const std::string& meshName, int spaceDim, const int *nodeStrctStart, const int *nodeStrctStop,
const double *originStart, const double *originStop, const double *dxyzStart, const double *dxyzStop)
{
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(new MEDCouplingIMesh);
+ MCAuto<MEDCouplingIMesh> ret(new MEDCouplingIMesh);
ret->setName(meshName);
ret->setSpaceDimension(spaceDim);
ret->setNodeStruct(nodeStrctStart,nodeStrctStop);
return ret.retn();
}
-MEDCouplingMesh *MEDCouplingIMesh::deepCpy() const
+MEDCouplingIMesh *MEDCouplingIMesh::deepCopy() const
{
return clone(true);
}
return new MEDCouplingIMesh(*this,recDeepCpy);
}
+const DataArrayDouble *MEDCouplingIMesh::getDirectAccessOfCoordsArrIfInStructure() const
+{
+ throw INTERP_KERNEL::Exception("MEDCouplingIMesh::getDirectAccessOfCoordsArrIfInStructure : MEDCouplingIMesh does not aggregate array of coordinates !");
+}
+
/*!
* This method creates a copy of \a this enlarged by \a ghostLev cells on each axis.
* If \a ghostLev equal to 0 this method behaves as MEDCouplingIMesh::clone.
{
if(ghostLev<0)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::buildWithGhost : the ghostLev must be >= 0 !");
- checkCoherency();
+ checkConsistencyLight();
int spaceDim(getSpaceDimension());
double origin[3],dxyz[3];
int structure[3];
dxyz[i]=_dxyz[i];
structure[i]=_structure[i]+2*ghostLev;
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(MEDCouplingIMesh::New(getName(),spaceDim,structure,structure+spaceDim,origin,origin+spaceDim,dxyz,dxyz+spaceDim));
+ MCAuto<MEDCouplingIMesh> ret(MEDCouplingIMesh::New(getName(),spaceDim,structure,structure+spaceDim,origin,origin+spaceDim,dxyz,dxyz+spaceDim));
ret->copyTinyInfoFrom(this);
return ret.retn();
}
*/
double MEDCouplingIMesh::getMeasureOfAnyCell() const
{
- checkCoherency();
+ checkConsistencyLight();
int dim(getSpaceDimension());
double ret(1.);
for(int i=0;i<dim;i++)
*/
MEDCouplingCMesh *MEDCouplingIMesh::convertToCartesian() const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingCMesh> ret(MEDCouplingCMesh::New());
+ checkConsistencyLight();
+ MCAuto<MEDCouplingCMesh> ret(MEDCouplingCMesh::New());
try
{ ret->copyTinyInfoFrom(this); }
catch(INTERP_KERNEL::Exception& ) { }
std::vector<std::string> infos(buildInfoOnComponents());
for(int i=0;i<spaceDim;i++)
{
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> arr(DataArrayDouble::New()); arr->alloc(_structure[i],1); arr->setInfoOnComponent(0,infos[i]);
+ MCAuto<DataArrayDouble> arr(DataArrayDouble::New()); arr->alloc(_structure[i],1); arr->setInfoOnComponent(0,infos[i]);
arr->iota(); arr->applyLin(_dxyz[i],_origin[i]);
ret->setCoordsAt(i,arr);
}
{
if((int)factors.size()!=_space_dim)
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::refineWithFactor : refinement factors must have size equal to spaceDim !");
- checkCoherency();
+ checkConsistencyLight();
std::vector<int> structure(_structure,_structure+3);
std::vector<double> dxyz(_dxyz,_dxyz+3);
for(int i=0;i<_space_dim;i++)
*
* \return MEDCouplingIMesh * - A newly created object (to be managed by the caller with decrRef) containing simply one cell.
*
- * \throw if \a this does not pass the \c checkCoherency test.
+ * \throw if \a this does not pass the \c checkConsistencyLight test.
*/
MEDCouplingIMesh *MEDCouplingIMesh::asSingleCell() const
{
- checkCoherency();
+ checkConsistencyLight();
int spaceDim(getSpaceDimension()),nodeSt[3];
double dxyz[3];
for(int i=0;i<spaceDim;i++)
dxyz[i]=_dxyz[i];
}
}
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(MEDCouplingIMesh::New(getName(),getSpaceDimension(),nodeSt,nodeSt+spaceDim,_origin,_origin+spaceDim,dxyz,dxyz+spaceDim));
+ MCAuto<MEDCouplingIMesh> ret(MEDCouplingIMesh::New(getName(),getSpaceDimension(),nodeSt,nodeSt+spaceDim,_origin,_origin+spaceDim,dxyz,dxyz+spaceDim));
ret->copyTinyInfoFrom(this);
return ret.retn();
}
}
/*!
- * Nothing is done here (except to check that the other is a ParaMEDMEM::MEDCouplingIMesh instance too).
- * The user intend that the nodes are the same, so by construction of ParaMEDMEM::MEDCouplingIMesh, \a this and \a other are the same !
+ * Nothing is done here (except to check that the other is a MEDCoupling::MEDCouplingIMesh instance too).
+ * The user intend that the nodes are the same, so by construction of MEDCoupling::MEDCouplingIMesh, \a this and \a other are the same !
*/
void MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith(const MEDCouplingMesh *other, int cellCompPol, double prec,
DataArrayInt *&cellCor) const
throw INTERP_KERNEL::Exception("MEDCouplingIMesh::checkDeepEquivalOnSameNodesWith : Meshes are not the same !");
}
-void MEDCouplingIMesh::checkCoherency() const
+void MEDCouplingIMesh::checkConsistencyLight() const
{
checkSpaceDimension();
for(int i=0;i<_space_dim;i++)
if(_structure[i]<1)
{
- std::ostringstream oss; oss << "MEDCouplingIMesh::checkCoherency : On axis " << i << "/" << _space_dim << ", number of nodes is equal to " << _structure[i] << " ! must be >=1 !";
+ std::ostringstream oss; oss << "MEDCouplingIMesh::checkConsistencyLight : On axis " << i << "/" << _space_dim << ", number of nodes is equal to " << _structure[i] << " ! must be >=1 !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
-void MEDCouplingIMesh::checkCoherency1(double eps) const
-{
- checkCoherency();
-}
-
-void MEDCouplingIMesh::checkCoherency2(double eps) const
+void MEDCouplingIMesh::checkConsistency(double eps) const
{
- checkCoherency1(eps);
+ checkConsistencyLight();
}
void MEDCouplingIMesh::getNodeGridStructure(int *res) const
MEDCouplingStructuredMesh *MEDCouplingIMesh::buildStructuredSubPart(const std::vector< std::pair<int,int> >& cellPart) const
{
- checkCoherency();
+ checkConsistencyLight();
int dim(getSpaceDimension());
if(dim!=(int)cellPart.size())
{
}
double retOrigin[3]={0.,0.,0.};
int retStruct[3]={0,0,0};
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingIMesh> ret(dynamic_cast<MEDCouplingIMesh *>(deepCpy()));
+ MCAuto<MEDCouplingIMesh> ret(dynamic_cast<MEDCouplingIMesh *>(deepCopy()));
for(int i=0;i<dim;i++)
{
int startNode(cellPart[i].first),endNode(cellPart[i].second+1);
}
ret->setNodeStruct(retStruct,retStruct+dim);
ret->setOrigin(retOrigin,retOrigin+dim);
- ret->checkCoherency();
+ ret->checkConsistencyLight();
return ret.retn();
}
void MEDCouplingIMesh::getBoundingBox(double *bbox) const
{
- checkCoherency();
+ checkConsistencyLight();
int dim(getSpaceDimension());
for(int idim=0; idim<dim; idim++)
{
*/
MEDCouplingFieldDouble *MEDCouplingIMesh::getMeasureField(bool isAbs) const
{
- checkCoherency();
+ checkConsistencyLight();
std::string name="MeasureOfMesh_";
name+=getName();
int nbelem(getNumberOfCells());
*/
DataArrayDouble *MEDCouplingIMesh::getCoordinatesAndOwner() const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ checkConsistencyLight();
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
int spaceDim(getSpaceDimension()),nbNodes(getNumberOfNodes());
ret->alloc(nbNodes,spaceDim);
double *pt(ret->getPointer());
* components. The caller is to delete this array using decrRef() as it is
* no more needed.
*/
-DataArrayDouble *MEDCouplingIMesh::getBarycenterAndOwner() const
+DataArrayDouble *MEDCouplingIMesh::computeCellCenterOfMass() const
{
- checkCoherency();
- MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> ret(DataArrayDouble::New());
+ checkConsistencyLight();
+ MCAuto<DataArrayDouble> ret(DataArrayDouble::New());
int spaceDim(getSpaceDimension()),nbCells(getNumberOfCells()),tmp[3],tmp2[3];
ret->alloc(nbCells,spaceDim);
double *pt(ret->getPointer()),shiftOrigin[3];
DataArrayDouble *MEDCouplingIMesh::computeIsoBarycenterOfNodesPerCell() const
{
- return MEDCouplingIMesh::getBarycenterAndOwner();
+ return MEDCouplingIMesh::computeCellCenterOfMass();
}
void MEDCouplingIMesh::renumberCells(const int *old2NewBg, bool check)
void MEDCouplingIMesh::writeVTKLL(std::ostream& ofs, const std::string& cellData, const std::string& pointData, DataArrayByte *byteData) const
{
- checkCoherency();
+ checkConsistencyLight();
std::ostringstream extent,origin,spacing;
for(int i=0;i<3;i++)
{