* Sets a time \a unit of \a this field. For more info, see \ref MEDCouplingFirstSteps3.
* \param [in] unit \a unit (string) in which time is measured.
*/
-void MEDCouplingFieldDouble::setTimeUnit(const char *unit)
+void MEDCouplingFieldDouble::setTimeUnit(const std::string& unit)
{
_time_discr->setTimeUnit(unit);
}
* Returns a time unit of \a this field.
* \return a string describing units in which time is measured.
*/
-const char *MEDCouplingFieldDouble::getTimeUnit() const
+std::string MEDCouplingFieldDouble::getTimeUnit() const
{
return _time_discr->getTimeUnit();
}
disc=_type->clone();
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),tdo,disc.retn());
ret->setMesh(getMesh());
- ret->setName(getName().c_str());
- ret->setDescription(getDescription().c_str());
+ ret->setName(getName());
+ ret->setDescription(getDescription());
return ret.retn();
}
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretizationP1> nsp(new MEDCouplingFieldDiscretizationP1);
ret->setDiscretization(nsp);
const MEDCouplingMesh *m(getMesh());//m is non empty thanks to checkCoherency call
- int nbCells(m->getNumberOfCells()),nbNodes(m->getNumberOfNodes());
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rn(DataArrayInt::New()),rni(DataArrayInt::New());
m->getReverseNodalConnectivity(rn,rni);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> rni2(rni->deltaShiftIndex());
std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > outArrsSafe(sz); std::vector<DataArrayDouble *> outArrs(sz);
for(std::size_t j=0;j<sz;j++)
{
- int nbCompo(arrs[j]->getNumberOfComponents());
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> tmp(arrs[j]->selectByTupleIdSafe(rn->begin(),rn->end()));
outArrsSafe[j]=(tmp->accumulatePerChunck(rni->begin(),rni->end())); tmp=0;
outArrsSafe[j]->divideEqual(rni3);
return ret.str();
}
-void MEDCouplingFieldDouble::writeVTK(const char *fileName, bool isBinary) const
+void MEDCouplingFieldDouble::writeVTK(const std::string& fileName, bool isBinary) const
{
std::vector<const MEDCouplingFieldDouble *> fs(1,this);
MEDCouplingFieldDouble::WriteVTK(fileName,fs,isBinary);
* \ref cpp_mcfielddouble_fillFromAnalytic "Here is a C++ example".<br>
* \ref py_mcfielddouble_fillFromAnalytic "Here is a Python example".
*/
-void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func)
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic : no mesh defined !");
* The function is applied to coordinates of value location points. For example, if
* \a this field is on cells, the function is applied to cell barycenters.<br>
* This method differs from
- * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) "fillFromAnalytic()"
+ * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func) "fillFromAnalytic()"
* by the way how variable
* names, used in the function, are associated with components of coordinates of field
* location points; here, a variable name corresponding to a component is retrieved from
* \ref cpp_mcfielddouble_fillFromAnalytic2 "Here is a C++ example".<br>
* \ref py_mcfielddouble_fillFromAnalytic2 "Here is a Python example".
*/
-void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::fillFromAnalytic2(int nbOfComp, const std::string& func)
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !");
* The function is applied to coordinates of value location points. For example, if
* \a this field is on cells, the function is applied to cell barycenters.<br>
* This method differs from
- * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const char *func) "fillFromAnalytic()"
+ * \ref ParaMEDMEM::MEDCouplingFieldDouble::fillFromAnalytic(int nbOfComp, const std::string& func) "fillFromAnalytic()"
* by the way how variable
* names, used in the function, are associated with components of coordinates of field
* location points; here, a component index of a variable is defined by a
* \ref cpp_mcfielddouble_fillFromAnalytic3 "Here is a C++ example".<br>
* \ref py_mcfielddouble_fillFromAnalytic3 "Here is a Python example".
*/
-void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingFieldDouble::fillFromAnalytic3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
{
if(!_mesh)
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::fillFromAnalytic2 : no mesh defined !");
* \ref cpp_mcfielddouble_applyFunc "Here is a C++ example".<br>
* \ref py_mcfielddouble_applyFunc "Here is a Python example".
*/
-void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func)
{
_time_discr->applyFunc(nbOfComp,func);
}
* For more info on supported expressions that can be used in the function, see \ref
* MEDCouplingArrayApplyFuncExpr. <br>
* This method differs from
- * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) "applyFunc()"
+ * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) "applyFunc()"
* by the way how variable
* names, used in the function, are associated with components of field values;
* here, a variable name corresponding to a component is retrieved from
* \ref cpp_mcfielddouble_applyFunc2 "Here is a C++ example".<br>
* \ref py_mcfielddouble_applyFunc2 "Here is a Python example".
*/
-void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const char *func)
+void MEDCouplingFieldDouble::applyFunc2(int nbOfComp, const std::string& func)
{
_time_discr->applyFunc2(nbOfComp,func);
}
* Modifies values of \a this field by applying a function to each tuple of all
* data arrays.
* This method differs from
- * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const char *func) "applyFunc()"
+ * \ref ParaMEDMEM::MEDCouplingFieldDouble::applyFunc(int nbOfComp, const std::string& func) "applyFunc()"
* by the way how variable
* names, used in the function, are associated with components of field values;
* here, a component index of a variable is defined by a
* \ref cpp_mcfielddouble_applyFunc3 "Here is a C++ example".<br>
* \ref py_mcfielddouble_applyFunc3 "Here is a Python example".
*/
-void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const char *func)
+void MEDCouplingFieldDouble::applyFunc3(int nbOfComp, const std::vector<std::string>& varsOrder, const std::string& func)
{
_time_discr->applyFunc3(nbOfComp,varsOrder,func);
}
* \ref cpp_mcfielddouble_applyFunc_same_nb_comp "Here is a C++ example".<br>
* \ref py_mcfielddouble_applyFunc_same_nb_comp "Here is a Python example".
*/
-void MEDCouplingFieldDouble::applyFunc(const char *func)
+void MEDCouplingFieldDouble::applyFunc(const std::string& func)
{
_time_discr->applyFunc(func);
}
* The field will contain exactly the same number of components after the call.
* Use is not warranted for the moment !
*/
-void MEDCouplingFieldDouble::applyFuncFast32(const char *func)
+void MEDCouplingFieldDouble::applyFuncFast32(const std::string& func)
{
_time_discr->applyFuncFast32(func);
}
* The field will contain exactly the same number of components after the call.
* Use is not warranted for the moment !
*/
-void MEDCouplingFieldDouble::applyFuncFast64(const char *func)
+void MEDCouplingFieldDouble::applyFuncFast64(const std::string& func)
{
_time_discr->applyFuncFast64(func);
}
double val=_mesh->getTime(it,ordr);
std::string timeUnit(_mesh->getTimeUnit());
setTime(val,it,ordr);
- setTimeUnit(timeUnit.c_str());
+ setTimeUnit(timeUnit);
}
/*!
int nbOfElemS=(int)tinyInfoS.size();
_name=tinyInfoS[nbOfElemS-3];
_desc=tinyInfoS[nbOfElemS-2];
- setTimeUnit(tinyInfoS[nbOfElemS-1].c_str());
+ setTimeUnit(tinyInfoS[nbOfElemS-1]);
}
/*!
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
std::ostringstream oss;
oss << "Max_" << getName();
- ret->setName(oss.str().c_str());
+ ret->setName(oss.str());
ret->setMesh(getMesh());
return ret.retn();
}
MEDCouplingTimeDiscretization *td=_time_discr->keepSelectedComponents(compoIds);
td->copyTinyAttrFrom(*_time_discr);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(getNature(),td,_type->clone());
- ret->setName(getName().c_str());
+ ret->setName(getName());
ret->setMesh(getMesh());
return ret.retn();
}
MEDCouplingTimeDiscretization *td=f1->_time_discr->aggregate(f2->_time_discr);
td->copyTinyAttrFrom(*f1->_time_discr);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(f1->getNature(),td,f1->_type->clone());
- ret->setName(f1->getName().c_str());
- ret->setDescription(f1->getDescription().c_str());
+ ret->setName(f1->getName());
+ ret->setDescription(f1->getDescription());
if(m1)
{
MEDCouplingAutoRefCountObjectPtr<MEDCouplingMesh> m=m1->mergeMyselfWith(m2);
MEDCouplingTimeDiscretization *td=tds[0]->aggregate(tds);
td->copyTinyAttrFrom(*(a[0]->_time_discr));
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> ret=new MEDCouplingFieldDouble(a[0]->getNature(),td,a[0]->_type->clone());
- ret->setName(a[0]->getName().c_str());
- ret->setDescription(a[0]->getDescription().c_str());
+ ret->setName(a[0]->getName());
+ ret->setDescription(a[0]->getDescription());
if(ms2[0])
{
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m=MEDCouplingUMesh::MergeUMeshes(ms2);
* \ref cpp_mcfielddouble_WriteVTK "Here is a C++ example".<br>
* \ref py_mcfielddouble_WriteVTK "Here is a Python example".
*/
-void MEDCouplingFieldDouble::WriteVTK(const char *fileName, const std::vector<const MEDCouplingFieldDouble *>& fs, bool isBinary)
+void MEDCouplingFieldDouble::WriteVTK(const std::string& fileName, const std::vector<const MEDCouplingFieldDouble *>& fs, bool isBinary)
{
if(fs.empty())
return;
}
TypeOfField typ=cur->getTypeOfField();
if(typ==ON_CELLS)
- cur->getArray()->writeVTK(coss,8,cur->getName().c_str(),byteArr);
+ cur->getArray()->writeVTK(coss,8,cur->getName(),byteArr);
else if(typ==ON_NODES)
- cur->getArray()->writeVTK(noss,8,cur->getName().c_str(),byteArr);
+ cur->getArray()->writeVTK(noss,8,cur->getName(),byteArr);
else
throw INTERP_KERNEL::Exception("MEDCouplingFieldDouble::WriteVTK : only node and cell fields supported for the moment !");
}