Nektar++
Functions | Variables
DBUtils Namespace Reference

Functions

template<class T >
void Output1DArray (const Array< OneD, const T > &in, const int start=0, const int stop=StopDefault)
 
template<class T >
void Output1DArray (const Array< OneD, const T > &in, std::string outfile, const int start=0, const int stop=StopDefault)
 
template<class T >
void Output1DArray (const Array< OneD, const T > &in, ofstream &ofile, const int start=0, const int stop=StopDefault)
 
template<class T >
void Output1DArray (const NekVector< T > &in, ofstream &ofile, const int start=0, const int stop=StopDefault)
 
template<class T >
void NormGlobalVector (const int n, Array< OneD, const T > &in, std::ostream &out, MultiRegions::AssemblyMapCGSharedPtr &map)
 

Variables

const int StopDefault = -99
 

Function Documentation

template<class T >
void DBUtils::NormGlobalVector ( const int  n,
Array< OneD, const T > &  in,
std::ostream &  out,
MultiRegions::AssemblyMapCGSharedPtr map 
)

Definition at line 159 of file DBUtils.hpp.

References Vmath::Dot2(), and Nektar::LibUtilities::ReduceSum.

164  {
165  Array<OneD, NekDouble> vExchange(1);
166  Array<OneD, int> m_map = map->GetGlobalToUniversalMapUnique();
167  vExchange[0] = Vmath::Dot2(n, in, in, m_map);
168  map->GetComm()->AllReduce(vExchange, Nektar::LibUtilities::ReduceSum);
169  out << "Norm: " << vExchange[0] << endl;
170  }
T Dot2(int n, const T *w, const T *x, const int *y)
vvtvp (vector times vector times vector): z = w*x*y
Definition: Vmath.cpp:931
template<class T >
void DBUtils::Output1DArray ( const Array< OneD, const T > &  in,
const int  start = 0,
const int  stop = StopDefault 
)

Definition at line 48 of file DBUtils.hpp.

References ASSERTL1.

50  {
51  int i;
52 
53  ASSERTL1(start < in.num_elements(), "Start value is outside array range ");
54 
55  if(stop == StopDefault)
56  {
57 
58  for(i = start; i < in.num_elements(); ++i)
59  {
60  cout << in[i] << endl;
61  }
62  }
63  else
64  {
65  ASSERTL1(stop <= in.num_elements(), "Stop value is outside array range ");
66 
67  for(i = start; i < stop; ++i)
68  {
69  cout << in[i] << endl;
70  }
71  }
72  }
const int StopDefault
Definition: DBUtils.hpp:46
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
template<class T >
void DBUtils::Output1DArray ( const Array< OneD, const T > &  in,
std::string  outfile,
const int  start = 0,
const int  stop = StopDefault 
)

Definition at line 74 of file DBUtils.hpp.

References ASSERTL1.

77  {
78  int i;
79 
80  ASSERTL1(start < in.num_elements(), "Start value is outside array range ");
81 
82  ofstream ofile(outfile.c_str());
83 
84  if(stop == StopDefault)
85  {
86 
87  for(i = start; i < in.num_elements(); ++i)
88  {
89  ofile << in[i] << endl;
90  }
91  }
92  else
93  {
94  ASSERTL1(stop <= in.num_elements(), "Stop value is outside array range ");
95 
96  for(i = start; i < stop; ++i)
97  {
98  ofile << in[i] << endl;
99  }
100  }
101 
102  }
const int StopDefault
Definition: DBUtils.hpp:46
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
template<class T >
void DBUtils::Output1DArray ( const Array< OneD, const T > &  in,
ofstream &  ofile,
const int  start = 0,
const int  stop = StopDefault 
)

Definition at line 104 of file DBUtils.hpp.

References ASSERTL1.

107  {
108  int i;
109 
110  ASSERTL1(start < in.num_elements(), "Start value is outside array range ");
111 
112  if(stop == StopDefault)
113  {
114 
115  for(i = start; i < in.num_elements(); ++i)
116  {
117  ofile << in[i] << endl;
118  }
119  }
120  else
121  {
122  ASSERTL1(stop <= in.num_elements(), "Stop value is outside array range ");
123 
124  for(i = start; i < stop; ++i)
125  {
126  ofile << in[i] << endl;
127  }
128  }
129 
130  }
const int StopDefault
Definition: DBUtils.hpp:46
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191
template<class T >
void DBUtils::Output1DArray ( const NekVector< T > &  in,
ofstream &  ofile,
const int  start = 0,
const int  stop = StopDefault 
)

Definition at line 132 of file DBUtils.hpp.

References ASSERTL1, and Nektar::NekVector< DataType >::GetDimension().

135  {
136  int i;
137 
138  ASSERTL1(start < in.GetDimension(), "Start value is outside array range ");
139 
140  if(stop == StopDefault)
141  {
142 
143  for(i = start; i < in.GetDimension(); ++i)
144  {
145  ofile << in[i] << endl;
146  }
147  }
148  else
149  {
150  ASSERTL1(stop <= in.GetDimension(), "Stop value is outside array range ");
151 
152  for(i = start; i < stop; ++i)
153  {
154  ofile << in[i] << endl;
155  }
156  }
157  }
const int StopDefault
Definition: DBUtils.hpp:46
unsigned int GetDimension() const
Returns the number of dimensions for the point.
Definition: NekVector.cpp:212
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
Definition: ErrorUtil.hpp:191

Variable Documentation

const int DBUtils::StopDefault = -99

Definition at line 46 of file DBUtils.hpp.