Select Git revision
MallocUtils.cpp
-
Christophe Geuzaine authoredChristophe Geuzaine authored
Field.cpp 62.06 KiB
// Gmsh - Copyright (C) 1997-2011 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
//
// Contributor(s):
// Jonathan Lambrechts
//
#include <stdlib.h>
#include <list>
#include <math.h>
#include <fstream>
#include <string>
#include <string.h>
#include <sstream>
#include "GmshConfig.h"
#include "Context.h"
#include "Field.h"
#include "GeoInterpolation.h"
#include "GModel.h"
#include "GmshMessage.h"
#include "Numeric.h"
#include "mathEvaluator.h"
#include "BackgroundMesh.h"
#if defined(HAVE_POST)
#include "OctreePost.h"
#include "PViewDataList.h"
#include "MVertex.h"
#endif
#if defined(HAVE_ANN)
#include "ANN/ANN.h"
#endif
class FieldOptionDouble : public FieldOption
{
public:
double &val;
FieldOptionType getType(){ return FIELD_OPTION_DOUBLE; }
FieldOptionDouble(double &_val, std::string _help, bool *_status=0)
: FieldOption(_help, _status), val(_val){}
double numericalValue() const { return val; }
void numericalValue(double v){ modified(); val = v; }
void getTextRepresentation(std::string &v_str)
{
std::ostringstream sstream;
sstream.precision(16);
sstream << val;
v_str = sstream.str();
}
};
class FieldOptionInt : public FieldOption
{
public:
int &val;
FieldOptionType getType(){ return FIELD_OPTION_INT; }
FieldOptionInt(int &_val, std::string _help, bool *_status=0)
: FieldOption(_help, _status), val(_val){}
double numericalValue() const { return val; }
void numericalValue(double v){ modified(); val = (int)v; }
void getTextRepresentation(std::string & v_str)
{
std::ostringstream sstream;
sstream << val;
v_str = sstream.str();
}
};