1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
// -*- C++ -*-
// -------------------------------------------------------------------
// MAdLib - Copyright (C) 2008-2009 Universite catholique de Louvain
//
// See the Copyright.txt and License.txt files for license information.
// You should have received a copy of these files along with MAdLib.
// If not, see <http://www.madlib.be/license/>
//
// Please report all bugs and problems to <contrib@madlib.be>
//
// Authors: Gaetan Compere, Jean-Francois Remacle
// -------------------------------------------------------------------
#ifndef _H_MADSTRINGFIELDEVALUATOR
#define _H_MADSTRINGFIELDEVALUATOR
#include "MAdFieldEvaluator.h"
#ifdef _HAVE_MATHEX_
#include "mathex.h"
#include <list>
#include <cstdarg>
#include <string>
#include <vector>
namespace MAd {
// ----------------------------------------------------------------------
class MAdStringFieldEvaluator : public MAdFieldEvaluator
{
public:
~MAdStringFieldEvaluator ();
// int numberOfStrings is the number of "const char *" given in "..."
MAdStringFieldEvaluator (int numberOfStrings, ...);
MAdStringFieldEvaluator(const std::vector<std::string>&);
private:
void buildEvaluators(const std::vector<std::string>& exp);
public:
bool eval (const double space[3], double time, double * val) const ;
bool eval (const std::vector<double> space, double time, double * val) const ;
int nbVar() const;
int order() const;
private:
mutable double x,y,z,t;
std::list<smlib::mathex*> expressions;
};
}
#else
#include "MAdMessage.h"
namespace MAd {
// ----------------------------------------------------------------------
class MAdStringFieldEvaluator : public MAdFieldEvaluator
{
public:
~MAdStringFieldEvaluator () {}
MAdStringFieldEvaluator (int, ...)
{
MAdMsgSgl::instance().error(__LINE__,__FILE__,
"No string evaluation library available");
}
MAdStringFieldEvaluator(const std::vector<std::string>&)
{
MAdMsgSgl::instance().error(__LINE__,__FILE__,
"No string evaluation library available");
}
private:
void buildEvaluators(const std::vector<std::string>&) { throw; }
public:
bool eval (const double space[3], double time, double * val) const
{ throw; return false; }
bool eval (const std::vector<double> space, double time, double * val) const
{ throw; return false; }
int nbVar() const { throw; return -1; }
int order() const { throw; return -1; }
};
// ----------------------------------------------------------------------
}
#endif
#endif
|