namespace bio = boost::iostreams;
using bio::stream;
using bio::tee_device;
static char help[] =
"...\n\n";
int main(
int argc,
char *argv[]) {
try {
int rank;
MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
PetscBool flg_mesh_file = PETSC_TRUE;
PetscBool flg_out_file = PETSC_TRUE;
double height = 1.0;
int dim = 2;
CHKERR PetscOptionsBegin(PETSC_COMM_WORLD,
"",
"ADD_PRISMS_LAYER",
"none");
CHKERR PetscOptionsString(
"-my_file",
"mesh file name",
"",
"mesh.h5m",
CHKERR PetscOptionsString(
"-my_out_file",
"out file name",
"",
"out.h5m",
CHKERR PetscOptionsInt(
"-my_dim",
"dimension (2 or 3)",
"", dim, &dim,
PETSC_NULL);
CHKERR PetscOptionsReal(
"-my_lambda",
"roughness wavelength",
"",
lambda,
CHKERR PetscOptionsReal(
"-my_delta",
"roughness amplitude",
"",
delta,
CHKERR PetscOptionsReal(
"-my_height",
"vertical dimension of the mesh",
"",
height, &height, PETSC_NULL);
int ierr = PetscOptionsEnd();
if (flg_mesh_file != PETSC_TRUE) {
SETERRQ(PETSC_COMM_SELF, 1, "*** ERROR -my_file (MESH FILE NEEDED)");
}
const char *option;
option = "";
ParallelComm *pcomm = ParallelComm::get_pcomm(&moab,
MYPCOMM_INDEX);
if (pcomm == NULL)
pcomm = new ParallelComm(&moab, PETSC_COMM_WORLD);
Range tets, tris, nodes, all_nodes;
if (
bit->getName().compare(0, 11,
"MAT_ELASTIC") == 0) {
const int id =
bit->getMeshsetId();
if (id == 1) {
3, tets, true);
2, tris, true);
}
}
}
all_nodes.merge(nodes);
nodes.clear();
all_nodes.merge(nodes);
double coords[3];
for (Range::iterator nit = all_nodes.begin(); nit != all_nodes.end();
nit++) {
CHKERR moab.get_coords(&*nit, 1, coords);
double x = coords[0];
double y = coords[1];
double z = coords[2];
double coef = (height + z) / height;
switch (dim) {
case 2:
coords[2] -= coef *
delta * (1. - cos(2. * M_PI * x /
lambda));
break;
case 3:
coords[2] -=
(1. - cos(2. * M_PI * x /
lambda) * cos(2. * M_PI * y /
lambda));
break;
default:
"Wrong dimension = %d", dim);
}
CHKERR moab.set_coords(&*nit, 1, coords);
}
}
return 0;
}