Atom test for getting boundary conditions from blocksets, sidesets and nodesets.
Atom test for getting boundary conditions from blocksets, sidesets and nodesets.
static char help[] =
"Read file and print boundary conditions (ex. "
"./cubit_bc_test -my_file disp01.h5m) \n\n";
int main(
int argc,
char *argv[]) {
try {
moab::Core mb_instance;
moab::Interface &moab = mb_instance;
int rank;
MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
PetscBool flg = PETSC_TRUE;
#if PETSC_VERSION_GE(3, 6, 4)
255, &flg);
#else
CHKERR PetscOptionsGetString(PETSC_NULL, PETSC_NULL,
"-my_file",
#endif
if (flg != PETSC_TRUE) {
"*** ERROR -my_file (MESH FILE NEEDED)");
}
const char *option;
option = "";
std::ofstream myfile;
std::cout << "<<<< NODESETs >>>>>" << std::endl;
std::cout << *it << std::endl;
CHKERR it->printBcData(std::cout);
std::vector<char> bc_data;
CHKERR it->getBcData(bc_data);
if (bc_data.empty())
continue;
if (strcmp(&bc_data[0], "Displacement") == 0) {
CHKERR it->getBcDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
}
else if (strcmp(&bc_data[0], "Force") == 0) {
CHKERR it->getBcDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
}
else if (strcmp(&bc_data[0], "Velocity") == 0) {
CHKERR it->getBcDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
}
else if (strcmp(&bc_data[0], "Acceleration") == 0) {
CHKERR it->getBcDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
}
else if (strcmp(&bc_data[0], "Temperature") == 0) {
CHKERR it->getBcDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
}
else
SETERRQ(PETSC_COMM_SELF, 1, "Error: Unrecognizable BC type");
}
std::cout << "<<<< SIDESETs >>>>>" << std::endl;
std::cout << *it << std::endl;
CHKERR it->printBcData(std::cout);
std::vector<char> bc_data;
CHKERR it->getBcData(bc_data);
if (bc_data.empty())
continue;
if (strcmp(&bc_data[0], "Pressure") == 0) {
CHKERR it->getBcDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
}
else if (strcmp(&bc_data[0], "HeatFlux") == 0) {
CHKERR it->getBcDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
}
else if (strcmp(&bc_data[0], "cfd_bc") == 0) {
CHKERR it->getBcDataStructure(mydata);
if (mydata.
data.type == 6) {
std::cout << std::endl << "Interface" << std::endl;
myfile << std::endl << "Interface" << std::endl;
std::cout << mydata;
myfile << mydata;
}
else if (mydata.
data.type == 15) {
std::cout << std::endl << "Pressure Inlet" << std::endl;
myfile << std::endl << "Pressure Inlet" << std::endl;
std::cout << mydata;
myfile << mydata;
}
else if (mydata.
data.type == 16) {
std::cout << std::endl << "Pressure Outlet" << std::endl;
myfile << std::endl << "Pressure Outlet" << std::endl;
std::cout << mydata;
myfile << mydata;
}
}
else
SETERRQ(PETSC_COMM_SELF, 1, "Error: Unrecognizable BC type");
}
std::cout << "<<<< BLOCKSETs >>>>>" << std::endl;
std::cout << std::endl << *it << std::endl;
CHKERR it->printName(std::cout);
std::vector<double> attributes;
CHKERR it->getAttributes(attributes);
CHKERR it->printAttributes(std::cout);
CHKERR it->printAttributes(myfile);
}
std::cout << std::endl << *it << std::endl;
std::string name = it->getName();
if (name.compare(0, 20, "MAT_ELASTIC_TRANSISO") == 0) {
CHKERR it->getAttributeDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
} else if (name.compare(0, 11, "MAT_ELASTIC") == 0) {
CHKERR it->getAttributeDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
} else if (name.compare(0, 10, "MAT_INTERF") == 0) {
CHKERR it->getAttributeDataStructure(mydata);
std::cout << mydata;
myfile << mydata;
} else
SETERRQ(PETSC_COMM_SELF, 1, "Error: Unrecognizable Material type");
}
myfile.close();
}
#define CATCH_ERRORS
Catch errors.
#define CHKERR
Inline error check.
#define _IT_CUBITMESHSETS_BY_SET_TYPE_FOR_LOOP_(MESHSET_MANAGER, CUBITBCTYPE, IT)
Iterator that loops over a specific Cubit MeshSet having a particular BC meshset in a moFEM field.
implementation of Data Operators for Forces and Sources
Definition of the acceleration bc data structure.
Definition of the cfd_bc data structure.
static MoFEMErrorCode Initialize(int *argc, char ***args, const char file[], const char help[])
Initializes the MoFEM database PETSc, MOAB and MPI.
static MoFEMErrorCode Finalize()
Checks for options to be called at the conclusion of the program.
Deprecated interface functions.
Definition of the displacement bc data structure.
Definition of the force bc data structure.
Definition of the heat flux bc data structure.
Transverse Isotropic material data structure.
Elastic material data structure.
Linear interface data structure.
Interface for managing meshsets containing materials and boundary conditions.
Definition of the pressure bc data structure.
Definition of the temperature bc data structure.
MoFEMErrorCode getInterface(IFACE *&iface) const
Get interface refernce to pointer of interface.
Definition of the velocity bc data structure.