[cig-commits] r13861 - cs/cigma/trunk/src
luis at geodynamics.org
luis at geodynamics.org
Tue Jan 13 03:12:05 PST 2009
Author: luis
Date: 2009-01-13 03:12:05 -0800 (Tue, 13 Jan 2009)
New Revision: 13861
Added:
cs/cigma/trunk/src/fn_gale2.cpp
cs/cigma/trunk/src/fn_gale2.h
Log:
Another analytic benchmark to compare against.
Added: cs/cigma/trunk/src/fn_gale2.cpp
===================================================================
--- cs/cigma/trunk/src/fn_gale2.cpp (rev 0)
+++ cs/cigma/trunk/src/fn_gale2.cpp 2009-01-13 11:12:05 UTC (rev 13861)
@@ -0,0 +1,39 @@
+#include "fn_gale2.h"
+//#include <iostream>
+//#include <typeinfo>
+#include <cmath>
+
+using namespace std;
+using namespace benchmark::circular_inclusion;
+
+Pressure::Pressure()
+{
+ //cout << "Creating instance of class " << typeid(this).name() << endl;
+}
+
+Pressure::~Pressure()
+{
+}
+
+bool Pressure::eval(double *x, double *value)
+{
+ const double R = 0.05;
+ const double C = (8*9/11.0)*R*R;
+ const double xc = 0.5;
+ const double yc = 0.5;
+ const double dx = x[0] - xc;
+ const double dy = x[1] - yc;
+ const double r2 = dx*dx + dy*dy;
+
+ if (r2 < R*R)
+ {
+ value[0] = 4.0;
+ }
+ else
+ {
+ double theta = atan2(dy, dx);
+ value[0] = (C/r2) * cos(2*theta);
+ }
+
+ return true;
+}
Added: cs/cigma/trunk/src/fn_gale2.h
===================================================================
--- cs/cigma/trunk/src/fn_gale2.h (rev 0)
+++ cs/cigma/trunk/src/fn_gale2.h 2009-01-13 11:12:05 UTC (rev 13861)
@@ -0,0 +1,28 @@
+#ifndef FN_GALE2_H
+#define FN_GALE2_H
+
+#include "Function.h"
+
+namespace benchmark
+{
+ namespace circular_inclusion
+ {
+ class Pressure;
+ }
+}
+
+class benchmark::circular_inclusion::Pressure : public cigma::Function
+{
+public:
+
+ Pressure();
+ ~Pressure();
+
+ virtual int n_dim() { return 2; }
+ virtual int n_rank() { return 1; }
+
+ virtual bool eval(double *x, double *value);
+
+};
+
+#endif
More information about the CIG-COMMITS
mailing list