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 {
int rank;
MPI_Comm_rank(PETSC_COMM_WORLD, &rank);
PetscBool flg = PETSC_TRUE;
#if PETSC_VERSION_GE(3, 6, 4)
255, &flg);
#else
#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();
}