00001
00002
00003
00004
00005
00006
00007 #ifndef AADAPT_ANALYTICFUNCTION_HPP
00008 #define AADAPT_ANALYTICFUNCTION_HPP
00009
00010 #include <string>
00011
00012
00013 #include <boost/random.hpp>
00014 #include <boost/random/normal_distribution.hpp>
00015 #include <boost/random/mersenne_twister.hpp>
00016 #include <boost/random/variate_generator.hpp>
00017
00018 #include "Teuchos_Array.hpp"
00019
00020 namespace AAdapt {
00021
00022
00023 long seedgen(int worksetID);
00024
00025
00026 class AnalyticFunction {
00027 public:
00028 virtual ~AnalyticFunction() {}
00029 virtual void compute(double* x, const double* X) = 0;
00030 };
00031
00032
00033 Teuchos::RCP<AnalyticFunction> createAnalyticFunction(
00034 std::string name, int neq, int numDim,
00035 Teuchos::Array<double> data);
00036
00037
00038
00039 class ConstantFunction : public AnalyticFunction {
00040 public:
00041 ConstantFunction(int neq_, int numDim_, Teuchos::Array<double> data_);
00042 void compute(double* x, const double* X);
00043 private:
00044 int numDim;
00045 int neq;
00046 Teuchos::Array<double> data;
00047 };
00048
00049 class ConstantFunctionPerturbed : public AnalyticFunction {
00050 public:
00051 ConstantFunctionPerturbed(int neq_, int numDim_, int worksetID,
00052 Teuchos::Array<double> const_data_, Teuchos::Array<double> pert_mag_);
00053 void compute(double* x, const double* X);
00054 private:
00055 int numDim;
00056 int neq;
00057 Teuchos::Array<double> data;
00058 Teuchos::Array<double> pert_mag;
00059
00060
00061 double udrand(double lo, double hi);
00062
00063 };
00064
00065 class ConstantFunctionGaussianPerturbed : public AnalyticFunction {
00066 public:
00067 ConstantFunctionGaussianPerturbed(int neq_, int numDim_, int worksetID,
00068 Teuchos::Array<double> const_data_, Teuchos::Array<double> pert_mag_);
00069 void compute(double* x, const double* X);
00070 private:
00071 int numDim;
00072 int neq;
00073 Teuchos::Array<double> data;
00074 Teuchos::Array<double> pert_mag;
00075
00076 boost::mt19937 rng;
00077 Teuchos::Array<Teuchos::RCP<boost::normal_distribution<double> > > nd;
00078 Teuchos::Array < Teuchos::RCP < boost::variate_generator < boost::mt19937&,
00079 boost::normal_distribution<double> > > > var_nor;
00080
00081 };
00082
00083 class GaussSin : public AnalyticFunction {
00084 public:
00085 GaussSin(int neq_, int numDim_, Teuchos::Array<double> data_);
00086 void compute(double* x, const double* X);
00087 private:
00088 int numDim;
00089 int neq;
00090 Teuchos::Array<double> data;
00091 };
00092
00093 class GaussCos : public AnalyticFunction {
00094 public:
00095 GaussCos(int neq_, int numDim_, Teuchos::Array<double> data_);
00096 void compute(double* x, const double* X);
00097 private:
00098 int numDim;
00099 int neq;
00100 Teuchos::Array<double> data;
00101 };
00102
00103 class LinearY : public AnalyticFunction {
00104 public:
00105 LinearY(int neq_, int numDim_, Teuchos::Array<double> data_);
00106 void compute(double* x, const double* X);
00107 private:
00108 int numDim;
00109 int neq;
00110 Teuchos::Array<double> data;
00111 };
00112
00113 class GaussianPress : public AnalyticFunction {
00114 public:
00115 GaussianPress(int neq_, int numDim_, Teuchos::Array<double> data_);
00116 void compute(double* x, const double* X);
00117 private:
00118 int numDim;
00119 int neq;
00120 Teuchos::Array<double> data;
00121 };
00122
00123 class SinCos : public AnalyticFunction {
00124 public:
00125 SinCos(int neq_, int numDim_, Teuchos::Array<double> data_);
00126 void compute(double* x, const double* X);
00127 private:
00128 int numDim;
00129 int neq;
00130 Teuchos::Array<double> data;
00131 };
00132
00133 class TaylorGreenVortex : public AnalyticFunction {
00134 public:
00135 TaylorGreenVortex(int neq_, int numDim_, Teuchos::Array<double> data_);
00136 void compute(double* x, const double* X);
00137 private:
00138 int numDim;
00139 int neq;
00140 Teuchos::Array<double> data;
00141 };
00142
00143 class AcousticWave : public AnalyticFunction {
00144 public:
00145 AcousticWave(int neq_, int numDim_, Teuchos::Array<double> data_);
00146 void compute(double* x, const double* X);
00147 private:
00148 int numDim;
00149 int neq;
00150 Teuchos::Array<double> data;
00151 };
00152
00153 class AerasScharDensity : public AnalyticFunction {
00154 public:
00155 AerasScharDensity(int neq_, int numDim_, Teuchos::Array<double> data_);
00156 void compute(double* x, const double* X);
00157 private:
00158 int numDim;
00159 int neq;
00160 Teuchos::Array<double> data;
00161 };
00162
00163 class AerasHeaviside : public AnalyticFunction {
00164 public:
00165 AerasHeaviside(int neq_, int numDim_, Teuchos::Array<double> data_);
00166 void compute(double* x, const double* X);
00167 private:
00168 int numDim;
00169 int neq;
00170 Teuchos::Array<double> data;
00171 };
00172
00173 class AerasCosineBell : public AnalyticFunction {
00174 public:
00175 AerasCosineBell(int neq_, int spatialDim_, Teuchos::Array<double> data_);
00176 void compute(double* x, const double* X);
00177 private:
00178 int spatialDim;
00179 int neq;
00180 Teuchos::Array<double> data;
00181 };
00182
00183 class AerasZonalFlow : public AnalyticFunction {
00184 public:
00185 AerasZonalFlow(int neq_, int spatialDim_, Teuchos::Array<double> data_);
00186 void compute(double* x, const double* X);
00187 private:
00188 int spatialDim;
00189 int neq;
00190 Teuchos::Array<double> data;
00191 };
00192
00193 class AerasPlanarCosineBell : public AnalyticFunction {
00194 public:
00195 AerasPlanarCosineBell(int neq_, int numDim_, Teuchos::Array<double> data_);
00196 void compute(double* x, const double* X);
00197 private:
00198 int numDim;
00199 int neq;
00200 Teuchos::Array<double> data;
00201 };
00202
00203 class AerasRossbyHaurwitzWave : public AnalyticFunction {
00204 public:
00205 AerasRossbyHaurwitzWave(int neq_, int spatialDim_, Teuchos::Array<double> data_);
00206 void compute(double* x, const double* X);
00207 private:
00208 int spatialDim;
00209 int neq;
00210 Teuchos::Array<double> data;
00211 };
00212
00213 }
00214
00215 #endif