const double* getValues ( void ) const ;
+ void getValues ( Vector myVector ) const ;
+
+ void setValues ( Vector values ) ;
+
+ void setValues ( double * values, int nbValues ) ;
+
const std::string getName ( void ) const;
const Mesh& getMesh ( void ) const ;
#include <fstream>
#include <sstream>
+#include <cstring>
+
using namespace MEDCoupling;
using namespace std;
return _field->getArray()->getConstPointer() ;
}
+//----------------------------------------------------------------------
+void
+Field::getValues ( Vector myVector ) const
+//----------------------------------------------------------------------
+{
+ if( myVector.size() != _field->getNumberOfTuples() * _field->getNumberOfComponents() )
+ throw CdmathException("Error : Field::getValues requires a vector having the same number of component as fiedl values");
+
+ const double * fieldValues = _field->getArray()->getConstPointer();
+ double * vectorValues = myVector.getValues().getValues();
+
+ memcpy(vectorValues, fieldValues,myVector.size()*sizeof(double)) ;
+}
+
+void
+Field::setValues ( Vector myVector )
+//----------------------------------------------------------------------
+{
+ if( myVector.size() != _field->getNumberOfTuples() * _field->getNumberOfComponents() )
+ throw CdmathException("Error : Field::setValues requires a vector having the same number of component as fiedl values");
+
+ double * vectorValues = myVector.getValues().getValues();
+
+ setValues ( vectorValues, myVector.size() );
+}
+
+void
+Field::setValues ( double * values, int nbValues )
+{
+ double * fieldValues = _field->getArray()->getPointer() ;
+ memcpy(fieldValues,values,nbValues*sizeof(double)) ;
+}
+
//----------------------------------------------------------------------
const string
Field::getName ( void ) const