#6394
antoniowu
Participant

Thank you for your comments. I’ve attached the code snippet for setting the geometry as below.

/// Stores geometry information in form of material numbers
void prepareGeometry(SuperGeometry2D<T>& superGeometry)
{

OstreamManager clout(std::cout,”prepareGeometry”);
clout << “Prepare Geometry …” << std::endl;

superGeometry.rename(0,2);
superGeometry.rename(2,1,1,1);

std::vector<T> extend( 2, T(0) );
extend[0] = nx+2;
extend[1] = 1;

/// Set material number for bottom and top
std::vector<T> origin( 2, T(0) );
origin[0] = -1;
IndicatorCuboid2D<T> bottom(extend, origin);
superGeometry.rename(2,3,1,bottom);

origin[1] = ny-1;
IndicatorCuboid2D<T> top(extend, origin);
superGeometry.rename(2,4,1,top);

/// Set material number for right
origin[0] = nx-1;
extend[0] = 1;
origin[1] = -1;
extend[1] = ny+1;
IndicatorCuboid2D<T> right(extend, origin);
superGeometry.rename(2,5,right);

/// Removes all not needed boundary voxels outside the surface
// superGeometry.clean();
/// Removes all not needed boundary voxels inside the surface
// superGeometry.innerClean();
superGeometry.checkForErrors();

superGeometry.print();

clout << “Prepare Geometry … OK” << std::endl;
}

/// === 2nd Step: Prepare Geometry ===
std::vector<T> extend(2,T());
extend[0] = nx;
extend[1] = ny;
std::vector<T> origin(2,T());
IndicatorCuboid2D<T> cuboid(extend, origin);

/// Instantiation of a cuboidGeometry with weights
#ifdef PARALLEL_MODE_MPI
const int noOfCuboids = singleton::mpi().getSize();
#else
const int noOfCuboids = 1;
#endif
CuboidGeometry2D<T> cuboidGeometry(cuboid, 1, noOfCuboids);
cuboidGeometry.setPeriodicity(false, false);