return simpleRepr();
}
-DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) const throw(INTERP_KERNEL::Exception)
+const DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) const throw(INTERP_KERNEL::Exception)
{
switch(i)
{
}
}
-void MEDCouplingCMesh::setCoordsAt(int i, DataArrayDouble *arr) throw(INTERP_KERNEL::Exception)
+DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
+{
+ switch(i)
+ {
+ case 0:
+ return _x_array;
+ case 1:
+ return _y_array;
+ case 2:
+ return _z_array;
+ default:
+ throw INTERP_KERNEL::Exception("Invalid rank specified must be 0 or 1 or 2.");
+ }
+}
+
+void MEDCouplingCMesh::setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception)
{
DataArrayDouble **thisArr[3]={&_x_array,&_y_array,&_z_array};
if(i<0 || i>2)
{
if(*(thisArr[i]))
(*(thisArr[i]))->decrRef();
- (*(thisArr[i]))=arr;
+ (*(thisArr[i]))=const_cast<DataArrayDouble *>(arr);
if(*(thisArr[i]))
(*(thisArr[i]))->incrRef();
declareAsNew();
}
}
-void MEDCouplingCMesh::setCoords(DataArrayDouble *coordsX, DataArrayDouble *coordsY, DataArrayDouble *coordsZ)
+void MEDCouplingCMesh::setCoords(const DataArrayDouble *coordsX, const DataArrayDouble *coordsY, const DataArrayDouble *coordsZ)
{
if(_x_array)
_x_array->decrRef();
- _x_array=coordsX;
+ _x_array=const_cast<DataArrayDouble *>(coordsX);
if(_x_array)
_x_array->incrRef();
if(_y_array)
_y_array->decrRef();
- _y_array=coordsY;
+ _y_array=const_cast<DataArrayDouble *>(coordsY);
if(_y_array)
_y_array->incrRef();
if(_z_array)
_z_array->decrRef();
- _z_array=coordsZ;
+ _z_array=const_cast<DataArrayDouble *>(coordsZ);
if(_z_array)
_z_array->incrRef();
declareAsNew();
int j=0;
for (int idim=0; idim<dim; idim++)
{
- DataArrayDouble *c=getCoordsAt(idim);
+ const DataArrayDouble *c=getCoordsAt(idim);
if(c)
{
const double *coords=c->getConstPointer();
double *pt=ret->getPointer();
int tmp[3];
getSplitNodeValues(tmp);
- DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
+ const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
const double *tabsPtr[3];
for(int j=0;j<spaceDim;j++)
{
double *pt=ret->getPointer();
int tmp[3];
getSplitCellValues(tmp);
- DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
+ const DataArrayDouble *tabs[3]={getCoordsAt(0),getCoordsAt(1),getCoordsAt(2)};
std::vector<double> tabsPtr[3];
for(int j=0;j<spaceDim;j++)
{
void getCoordinatesOfNode(int nodeId, std::vector<double>& coo) const;
std::string simpleRepr() const;
std::string advancedRepr() const;
- DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception);
- void setCoordsAt(int i, DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
- void setCoords(DataArrayDouble *coordsX,
- DataArrayDouble *coordsY=0,
- DataArrayDouble *coordsZ=0);
+ const DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception);
+ DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception);
+ void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
+ void setCoords(const DataArrayDouble *coordsX,
+ const DataArrayDouble *coordsY=0,
+ const DataArrayDouble *coordsZ=0);
// tools
DataArrayInt *checkTypeConsistencyAndContig(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception);
boundingBox[i]=std::numeric_limits<double>::max();
boundingBox[SPACEDIM+i]=-std::numeric_limits<double>::max();
}
- ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords();
+ const ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords();
const double *ptr=array->getConstPointer();
int nbOfPts=array->getNbOfElems()/SPACEDIM;
for(int j=0;j<SPACEDIM;j++)
template<int SPACEDIM,int MESHDIM>
const double *MEDCouplingNormalizedUnstructuredMesh<SPACEDIM,MESHDIM>::getCoordinatesPtr() const
{
- ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords();
+ const ParaMEDMEM::DataArrayDouble *array=_mesh->getCoords();
return array->getConstPointer();
}
}
}
-void MEDCouplingPointSet::setCoords(DataArrayDouble *coords)
+void MEDCouplingPointSet::setCoords(const DataArrayDouble *coords)
{
if( coords != _coords )
{
if (_coords)
_coords->decrRef();
- _coords=coords;
+ _coords=const_cast<DataArrayDouble *>(coords);
if(_coords)
_coords->incrRef();
declareAsNew();
{
if(_coords)
{
- a2=getCoords();
+ a2=const_cast<DataArrayDouble *>(getCoords());
a2->incrRef();
}
else
void updateTime() const;
int getNumberOfNodes() const;
int getSpaceDimension() const;
- void setCoords(DataArrayDouble *coords);
- DataArrayDouble *getCoords() const { return _coords; }
+ void setCoords(const DataArrayDouble *coords);
+ const DataArrayDouble *getCoords() const { return _coords; }
+ DataArrayDouble *getCoords() { return _coords; }
DataArrayDouble *getCoordinatesAndOwner() const;
void copyTinyStringsFrom(const MEDCouplingMesh *other) throw(INTERP_KERNEL::Exception);
bool isEqual(const MEDCouplingMesh *other, double prec) const;
*/
void MEDCouplingUMesh::tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception)
{
- DataArrayDouble *coords=other.getCoords();
+ const DataArrayDouble *coords=other.getCoords();
if(!coords)
throw INTERP_KERNEL::Exception("tryToShareSameCoordsPermute : No coords specified in other !");
if(!_coords)
{
if(meshes.empty())
throw INTERP_KERNEL::Exception("meshes input parameter is expected to be non empty.");
- DataArrayDouble *coords=meshes.front()->getCoords();
+ const DataArrayDouble *coords=meshes.front()->getCoords();
int meshDim=meshes.front()->getMeshDimension();
std::vector<const MEDCouplingUMesh *>::const_iterator iter=meshes.begin();
int meshLgth=0;
MEDCOUPLING_EXPORT const std::set<INTERP_KERNEL::NormalizedCellType>& getAllTypes() const { return _types; }
MEDCOUPLING_EXPORT std::set<INTERP_KERNEL::NormalizedCellType> getTypesOfPart(const int *begin, const int *end) const throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void setConnectivity(DataArrayInt *conn, DataArrayInt *connIndex, bool isComputingTypes=true);
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() const { return _nodal_connec; }
- MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivityIndex() const { return _nodal_connec_index; }
+ MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivity() const { return _nodal_connec; }
+ MEDCOUPLING_EXPORT const DataArrayInt *getNodalConnectivityIndex() const { return _nodal_connec_index; }
+ MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivity() { return _nodal_connec; }
+ MEDCOUPLING_EXPORT DataArrayInt *getNodalConnectivityIndex() { return _nodal_connec_index; }
MEDCOUPLING_EXPORT INTERP_KERNEL::NormalizedCellType getTypeOfCell(int cellId) const;
MEDCOUPLING_EXPORT int getNumberOfCellsWithType(INTERP_KERNEL::NormalizedCellType type) const;
MEDCOUPLING_EXPORT void getNodeIdsOfCell(int cellId, std::vector<int>& conn) const;
%rename(assign) *::operator=;
%ignore ParaMEDMEM::MemArray::operator=;
%ignore ParaMEDMEM::MemArray::operator[];
-%ignore ParaMEDMEM::MEDCouplingPointSet::getCoords();
%ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationIntInfo;
%ignore ParaMEDMEM::MEDCouplingGaussLocalization::pushTinySerializationDblInfo;
%ignore ParaMEDMEM::MEDCouplingGaussLocalization::fillWithValues;
{
public:
void updateTime() const;
- void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
+ void setCoords(const DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
DataArrayDouble *getCoordinatesAndOwner() const throw(INTERP_KERNEL::Exception);
bool areCoordsEqual(const MEDCouplingPointSet& other, double prec) const throw(INTERP_KERNEL::Exception);
void zipCoords() throw(INTERP_KERNEL::Exception);
return res;
}
- PyObject *getCoords() const throw(INTERP_KERNEL::Exception)
+ PyObject *getCoords() throw(INTERP_KERNEL::Exception)
{
DataArrayDouble *ret1=self->getCoords();
ret1->incrRef();
INTERP_KERNEL::AutoPtr<int> tmp=convertPyToNewIntArr2(li,&sz);
self->insertNextCell(type,size,tmp);
}
- DataArrayInt *getNodalConnectivity() const throw(INTERP_KERNEL::Exception)
+ DataArrayInt *getNodalConnectivity() throw(INTERP_KERNEL::Exception)
{
DataArrayInt *ret=self->getNodalConnectivity();
if(ret)
ret->incrRef();
return ret;
}
- DataArrayInt *getNodalConnectivityIndex() const throw(INTERP_KERNEL::Exception)
+ DataArrayInt *getNodalConnectivityIndex() throw(INTERP_KERNEL::Exception)
{
DataArrayInt *ret=self->getNodalConnectivityIndex();
if(ret)
{
public:
static MEDCouplingCMesh *New();
- void setCoords(DataArrayDouble *coordsX,
- DataArrayDouble *coordsY=0,
- DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
- void setCoordsAt(int i, DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
+ void setCoords(const DataArrayDouble *coordsX,
+ const DataArrayDouble *coordsY=0,
+ const DataArrayDouble *coordsZ=0) throw(INTERP_KERNEL::Exception);
+ void setCoordsAt(int i, const DataArrayDouble *arr) throw(INTERP_KERNEL::Exception);
%extend {
std::string __str__() const
{
return self->simpleRepr();
}
- DataArrayDouble *getCoordsAt(int i) const throw(INTERP_KERNEL::Exception)
+ DataArrayDouble *getCoordsAt(int i) throw(INTERP_KERNEL::Exception)
{
DataArrayDouble *ret=self->getCoordsAt(i);
if(ret)
DataArrayDouble *MEDFileUMesh::checkMultiMesh(const std::vector<const MEDCouplingUMesh *>& ms) const throw(INTERP_KERNEL::Exception)
{
- DataArrayDouble *ret=ms[0]->getCoords();
+ const DataArrayDouble *ret=ms[0]->getCoords();
int mdim=ms[0]->getMeshDimension();
for(unsigned int i=1;i<ms.size();i++)
{
if(ms[i]->getMeshDimension()!=mdim)
throw INTERP_KERNEL::Exception("MEDFileUMesh::checkMultiMesh : meshes have not same mesh dimension !");
}
- return ret;
+ return const_cast<DataArrayDouble *>(ret);
}
void MEDFileUMesh::setFamilyFieldArr(int meshDimRelToMaxExt, DataArrayInt *famArr) throw(INTERP_KERNEL::Exception)
MEDmeshGridTypeWr(fid,maa,MED_CARTESIAN_GRID);
for(int i=0;i<spaceDim;i++)
{
- DataArrayDouble *da=_cmesh->getCoordsAt(i);
+ const DataArrayDouble *da=_cmesh->getCoordsAt(i);
MEDmeshGridIndexCoordinateWr(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer());
}
if((const DataArrayInt *)_fam_cells)
MEDLoaderBase::safeStrCpy(mesh[0]->getDescription(),MED_COMMENT_SIZE,desc,MEDLoader::_TOO_LONG_STR);
const int spaceDim=mesh[0]->getSpaceDimension();
const int meshDim=mesh[0]->getMeshDimension();
- DataArrayDouble *arr=mesh[0]->getCoords();
+ const DataArrayDouble *arr=mesh[0]->getCoords();
INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(spaceDim*MED_SNAME_SIZE);
for(int i=0;i<spaceDim;i++)
}
if(meshes.empty())
throw INTERP_KERNEL::Exception("List of meshes must be not empty !");
- DataArrayDouble *coords=meshes.front()->getCoords();
+ const DataArrayDouble *coords=meshes.front()->getCoords();
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=meshes.begin();iter!=meshes.end();iter++)
if(coords!=(*iter)->getCoords())
throw INTERP_KERNEL::Exception("Meshes does not not share the same coordinates : try method MEDCouplingPointSet::tryToShareSameCoords !");
}
if(meshes.empty())
throw INTERP_KERNEL::Exception("List of meshes must be not empty !");
- DataArrayDouble *coords=meshes.front()->getCoords();
+ const DataArrayDouble *coords=meshes.front()->getCoords();
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=meshes.begin();iter!=meshes.end();iter++)
if(coords!=(*iter)->getCoords())
throw INTERP_KERNEL::Exception("Meshes does not not share the same coordinates : try method MEDCouplingPointSet::tryToShareSameCoords !");
std::string meshName(meshes[0]->getName());
if(meshName.empty())
throw INTERP_KERNEL::Exception("Trying to write a unstructured mesh with no name ! MED file format needs a not empty mesh name : change name of first element of 2nd parameter !");
- DataArrayDouble *coords=meshes.front()->getCoords();
+ const DataArrayDouble *coords=meshes.front()->getCoords();
for(std::vector<const ParaMEDMEM::MEDCouplingUMesh *>::const_iterator iter=meshes.begin();iter!=meshes.end();iter++)
if(coords!=(*iter)->getCoords())
throw INTERP_KERNEL::Exception("Meshes does not not share the same coordinates : try method MEDCouplingPointSet::tryToShareSameCoords !");