-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2014 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
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
return new MEDCouplingCMesh;
}
-MEDCouplingCMesh *MEDCouplingCMesh::New(const char *meshName)
+MEDCouplingCMesh *MEDCouplingCMesh::New(const std::string& meshName)
{
MEDCouplingCMesh *ret=new MEDCouplingCMesh;
ret->setName(meshName);
* referred by \a this mesh.
* \throw If \a i is not one of [0,1,2].
*
+ * \if ENABLE_EXAMPLES
* \ref cpp_mccmesh_getCoordsAt "Here is a C++ example".<br>
* \ref py_mccmesh_getCoordsAt "Here is a Python example".
+ * \endif
*/
const DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i) const
{
* referred by \a this mesh.
* \throw If \a i is not one of [0,1,2].
*
+ * \if ENABLE_EXAMPLES
* \ref cpp_mccmesh_getCoordsAt "Here is a C++ example".<br>
* \ref py_mccmesh_getCoordsAt "Here is a Python example".
+ * \endif
*/
DataArrayDouble *MEDCouplingCMesh::getCoordsAt(int i)
{
* \throw If \a arr->getNumberOfComponents() != 1.
* \throw If \a i is not one of [0,1,2].
*
+ * \if ENABLE_EXAMPLES
* \ref medcouplingcppexamplesCmeshStdBuild1 "Here is a C++ example".<br>
* \ref medcouplingpyexamplesCmeshStdBuild1 "Here is a Python example".
+ * \endif
*/
void MEDCouplingCMesh::setCoordsAt(int i, const DataArrayDouble *arr)
{
* axis. It must be an array of one component or \c NULL.
* \throw If \a coords*->getNumberOfComponents() != 1.
*
+ * \if ENABLE_EXAMPLES
* \ref medcouplingcppexamplesCmeshStdBuild1 "Here is a C++ example".<br>
* \ref medcouplingpyexamplesCmeshStdBuild1 "Here is a Python example".
+ * \endif
*/
void MEDCouplingCMesh::setCoords(const DataArrayDouble *coordsX, const DataArrayDouble *coordsY, const DataArrayDouble *coordsZ)
{
name+=getName();
int nbelem=getNumberOfCells();
MEDCouplingFieldDouble *field=MEDCouplingFieldDouble::New(ON_CELLS,ONE_TIME);
- field->setName(name.c_str());
+ field->setName(name);
DataArrayDouble* array=DataArrayDouble::New();
array->alloc(nbelem,1);
double *area_vol=array->getPointer();
for(int j=0;j<spaceDim;j++)
{
tabsPtr[j]=tabs[j]->getConstPointer();
- ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0).c_str());
+ ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0));
}
int tmp2[3];
for(int i=0;i<nbNodes;i++)
for(int j=0;j<spaceDim;j++)
{
int sz=tabs[j]->getNbOfElems()-1;
- ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0).c_str());
+ ret->setInfoOnComponent(j,tabs[j]->getInfoOnComponent(0));
const double *srcPtr=tabs[j]->getConstPointer();
tabsPtr[j].insert(tabsPtr[j].end(),srcPtr,srcPtr+sz);
std::transform(tabsPtr[j].begin(),tabsPtr[j].end(),srcPtr+1,tabsPtr[j].begin(),std::plus<double>());
void MEDCouplingCMesh::unserialization(const std::vector<double>& tinyInfoD, const std::vector<int>& tinyInfo, const DataArrayInt *a1, DataArrayDouble *a2,
const std::vector<std::string>& littleStrings)
{
- setName(littleStrings[0].c_str());
- setDescription(littleStrings[1].c_str());
- setTimeUnit(littleStrings[2].c_str());
+ setName(littleStrings[0]);
+ setDescription(littleStrings[1]);
+ setTimeUnit(littleStrings[2]);
DataArrayDouble **thisArr[3]={&_x_array,&_y_array,&_z_array};
const double *data=a2->getConstPointer();
for(int i=0;i<3;i++)
{
(*(thisArr[i]))=DataArrayDouble::New();
(*(thisArr[i]))->alloc(tinyInfo[i],1);
- (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+3].c_str());
+ (*(thisArr[i]))->setInfoOnComponent(0,littleStrings[i+3]);
std::copy(data,data+tinyInfo[i],(*(thisArr[i]))->getPointer());
data+=tinyInfo[i];
}