CppNoddy  0.92
Loading...
Searching...
No Matches
Functions
1DNodeMeshComplex.cpp File Reference

A simple check of the OneD_Node_Mesh container that stores nodal data over a given mesh. More...

#include <OneD_Node_Mesh.h>
#include <Utility.h>

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

A simple check of the OneD_Node_Mesh container that stores nodal data over a given mesh.

This checks that mesh data is interpolated and integrated correctly. We write $ \cos(x) $ to a uniform mesh, then check the integration routines converge appropriately. We then re-interpolate the data onto a non-uniform mesh and check the integral again.

Definition in file 1DNodeMeshComplex.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 18 of file 1DNodeMeshComplex.cpp.

19{
20 cout.precision( 10 );
21 cout << "\n";
22 cout << "=== OneD_Node_Mesh: complex data on a complex path =\n";
23 cout << "\n";
24
25
26 // Number of points
27 std::size_t N(11);
28 // parameterisation of a complex path
29 DenseVector<double> paramCoords( Utility::uniform_node_vector( 0.0, 1.0, N ) );
30 DenseVector<D_complex> z( N, D_complex(0.0,0.0) );
31 // the data stored on the complex path
33 // i
34 D_complex eye(0.0,1.0);
35
36 // Set the variable values to be defined by a Cosine.
37 for ( std::size_t i = 0; i < N; ++i ) {
38 double s = paramCoords[i];
39 Q.coord(i) = s + eye*s*(1-s);
40 // mesh stores
41 Q( i, 0 ) = sin( Q.coord(i) );
42 }
43 Q.dump_gnu("./data.dat");
44 Q.dump();
45
46 OneD_Node_Mesh<D_complex,D_complex> P( "./data.dat", N, 1 );
47 P.dump();
48
49}
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
A one dimensional mesh utility object.
const D_complex eye(0., 1.0)
double s
relative rotation rate
DenseVector< double > uniform_node_vector(const double &lower, const double &upper, const std::size_t &N)
Return a DENSE vector with the nodal points of a uniform mesh distributed between the upper/lower bou...
Definition: Utility.cpp:113
std::complex< double > D_complex
A complex double precision number using std::complex.
Definition: Types.h:98

References CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::coord(), CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::dump(), CppNoddy::OneD_Node_Mesh< _Type, _Xtype >::dump_gnu(), and CppNoddy::Utility::uniform_node_vector().

© 2012

R.E. Hewitt