NeoPZ
pzreal.cpp
Go to the documentation of this file.
1 
7 #include "pzreal.h"
8 #include <string>
9 #include <exception>
10 
11 using namespace std;
12 
13 //int HDivPiola = 1;
14 
16 
17 static string names[] = {
18  "sum",
19  "prod",
20  "div",
21  "sqrt",
22  "pow",
23  "cos",
24  "sin",
25  "acos",
26  "asin",
27  "atan",
28  "exp",
29  "log"
30 };
31 
32 void TPZCounter::Print(std::ostream &out) const
33 {
34  int i;
35  for(i=0; i<gNumOp; i++)
36  {
37  out << names[i] << " " << fCount[i] << endl;
38  }
39 }
40 std::ostream &operator<<(std::ostream &out,const TPZCounter &count)
41 {
42  int i;
43  for(i=0; i<gNumOp; i++)
44  {
45  out << names[i] << "/" << count.fCount[i] << "\t";
46  }
47  return out;
48 }
49 
50 #ifdef WIN32
51 //#include <Dialogs.hpp>
52 #endif // WIN32
53 
54 //#if !defined(__cplusplus) || __cplusplus < 201103L // If we aren't using C++11.
55 #if (!defined(__cplusplus) || __cplusplus < 201103L) && (!defined(_MSC_VER) || _MSC_VER < 1900)// If we aren't using C++11.
56 
60 REAL erf(REAL arg) {
61  REAL a1 = 0.254829592;
62  REAL a2 = -0.284496736;
63  REAL a3 = 1.421413741;
64  REAL a4 = -1.453152027;
65  REAL a5 = 1.061405429;
66  REAL p = 0.3275911;
67  // Save the sign of arg
68  int sign = 1;
69  if(arg < 0) sign = -1;
70  arg = fabs(arg);
71 
72  // A&S formula 7.1.26
73  REAL t = 1.0/(1.0 + p*arg);
74  REAL y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-arg*arg);
75 
76  return sign*y;
77 }
78 #endif // not C++11
static TPZCounter gCount
Containts the counter vector by operation performed.
Definition: pzreal.h:270
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
Definition: tfadfunc.h:140
REAL erf(REAL arg)
Definition: pzreal.cpp:60
const int gNumOp
Number of type of the operations actually counted.
Definition: pzreal.h:108
void Print(std::ostream &out=std::cout) const
Definition: pzreal.cpp:32
Implements a counter by operations. Common.
Definition: pzreal.h:111
static string names[]
Definition: pzreal.cpp:17
std::ostream & operator<<(std::ostream &out, const TPZCounter &count)
Re-implements << operator to show the counter (count) data.
Definition: pzreal.cpp:40
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ exp
Definition: tfadfunc.h:125
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
uint64_t fCount[gNumOp]
Definition: pzreal.h:114