int main(int argc, char **args) { int res = ERR_SUCCESS; if (argc < 1) error("Not enough parameters."); Mesh mesh; H3DReader mesh_loader; if (!mesh_loader.load(args[1], &mesh)) error("Loading mesh file '%s'\n", args[1]); // apply refinements bool ok = true; for (int k = 2; k < argc && ok; k += 2) { int elem_id, reft_id; sscanf(args[k], "%d", &elem_id); reft_id = parse_reft(args[k + 1]); ok = mesh.refine_element(elem_id, reft_id); } if (ok) { mesh.dump(); } else { warning("Unable to refine a mesh."); res = ERR_FAILURE; } return res; }
int main(int argc, char **args) { int res = ERR_SUCCESS; #ifdef WITH_PETSC PetscInitialize(&argc, &args, (char *) PETSC_NULL, PETSC_NULL); #endif set_verbose(false); TRACE_START("trace.txt"); DEBUG_OUTPUT_ON; SET_VERBOSE_LEVEL(0); if (argc < 2) error("Not enough parameters."); ECopyType copy_type = parse_copy_type(args[1]); if (copy_type == CT_NONE) error("Unknown copy type (%s).\n", args[1]); Mesh mesh; H3DReader mesh_loader; if (!mesh_loader.load(args[2], &mesh)) error("Loading mesh file '%s'\n", args[2]); // apply refinements bool ok = true; for (int k = 3; k < argc && ok; k += 2) { int elem_id, reft_id; sscanf(args[k], "%d", &elem_id); reft_id = parse_reft(args[k + 1]); ok = mesh.refine_element(elem_id, reft_id); } if (ok) { Mesh dup; switch (copy_type) { case CT_COPY: dup.copy(mesh); break; case CT_COPY_BASE: dup.copy_base(mesh); break; default: break; } dup.dump(); } else { warning("Unable to refine a mesh."); res = ERR_FAILURE; } #ifdef WITH_PETSC PetscFinalize(); #endif TRACE_END; return res; }
int main(int argc, char **args) { // Test variable. int success_test = 1; if (argc < 2) error("Not enough parameters."); ECopyType copy_type = parse_copy_type(args[1]); if (copy_type == CT_NONE) error("Unknown copy type (%s).\n", args[1]); Mesh mesh; H3DReader mloader; if (!mloader.load(args[2], &mesh)) error("Loading mesh file '%s'.", args[2]); // Apply refinements. bool ok = true; for (int k = 3; k < argc && ok; k += 2) { int elem_id, reft_id; sscanf(args[k], "%d", &elem_id); reft_id = parse_reft(args[k + 1]); ok = mesh.refine_element(elem_id, reft_id); } if (ok) { Mesh dup; switch (copy_type) { case CT_COPY: dup.copy(mesh); break; case CT_COPY_BASE: dup.copy_base(mesh); break; default: break; } dup.dump(); } else { warning("Unable to refine a mesh."); success_test = 0; } if (success_test) { return ERR_SUCCESS; } else { return ERR_FAILURE; } }
int main(int argc, char **args) { int res = ERR_SUCCESS; #ifdef WITH_PETSC PetscInitialize(&argc, &args, (char *) PETSC_NULL, PETSC_NULL); #endif set_verbose(false); TRACE_START("trace.txt"); DEBUG_OUTPUT_ON; SET_VERBOSE_LEVEL(0); if (argc < 1) error("Not enough parameters"); Mesh mesh; Mesh3DReader mesh_loader; if (!mesh_loader.load(args[1], &mesh)) error("Loading mesh file '%s'\n", args[1]); // apply refinements bool ok = true; for (int k = 2; k < argc && ok; k += 2) { int elem_id, reft_id; sscanf(args[k], "%d", &elem_id); reft_id = parse_reft(args[k + 1]); ok = mesh.refine_element(elem_id, reft_id); } if (ok) { mesh.dump(); } else { warning("Unable to refine a mesh."); res = ERR_FAILURE; } #ifdef WITH_PETSC PetscFinalize(); #endif TRACE_END; return res; }
int main(int argc, char *argv[]) { set_verbose(false); if (argc < 1) error("Not enough parameters"); Mesh mesh; H3DReader mesh_loader; if (!mesh_loader.load(argv[1], &mesh)) error("Loading mesh file '%s'\n", argv[1]); // apply refinements bool ok = true; for (int k = 2; k < argc && ok; k += 2) { int elem_id, reft_id; sscanf(argv[k], "%d", &elem_id); reft_id = parse_reft(argv[k + 1]); ok = mesh.refine_element(elem_id, reft_id); } mesh.regularize(); mesh.dump(); #ifdef OUTPUT_DIR const char *of_name = OUTPUT_DIR "/mesh.gmsh"; FILE *ofile = fopen(of_name, "w"); if (ofile != NULL) { GmshOutputEngine output(ofile); output.out(&mesh); fclose(ofile); } else { warning("Can not open '%s' for writing.", of_name); } #endif return ERR_SUCCESS; }