beginner tutorial, example 4: Demonstrates creating a structured meshIn this example, we create a 2x2x2 mesh that is identical to the previous example. However, in this case we will use the structured mesh interface since the mesh we created is logically structured. There are many advantages to using the structured mesh interface...such as memory savings, speed, ease-of-use...
- Author
- Milad Fatenejad
#include <iostream>
#include <cmath>
{
const unsigned NI = 100;
const unsigned NJ = 100;
"scdint->construct_box failed" );
const double DX = 0.1;
const double DY = 0.1;
for( unsigned i = 0; i < NI + 1; i++ )
for( unsigned j = 0; j < NJ + 1; j++ )
{
double coord[3] = { DX * i, DY * j, 0.0 };
}
double temp_default_value = 0.0;
double vel_default_value[2] = { 0.0, 0.0 };
vel_default_value );
MB_CHK_SET_ERR( rval,
"mbint.tag_get_handle(velocity) failed" );
for( unsigned i = 0; i < NI; i++ )
for( unsigned j = 0; j < NJ; j++ )
{
double xc = DX * ( i + 0.5 );
double yc = DY * ( j + 0.5 );
double r = std::sqrt( xc * xc + yc * yc );
double temperature = std::exp( -0.5 * r );
"mbint.tag_set_data(temp_tag) failed" );
}
for( unsigned i = 0; i < NI + 1; i++ )
for( unsigned j = 0; j < NJ + 1; j++ )
{
double velocity[2] = { i, j };
}
return 0;
}