Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "time.h"
00012
00013 #include "topology/Topology.h"
00014 #include "topology/Topology_Utils.h"
00015
00016 int
00017 main(int ac, char* av[])
00018 {
00019
00020
00021
00022
00023 Teuchos::CommandLineProcessor command_line_processor;
00024
00025 command_line_processor.setDocString("Test of barycentric subdivision.\n"
00026 "Reads in a mesh and applies the barycentric subdivision algorithm.\n"
00027 "Restricted to simplicial complexes.\n");
00028
00029 std::string input_file = "input.e";
00030 command_line_processor.setOption("input", &input_file, "Input File Name");
00031
00032 std::string output_file = "output.e";
00033 command_line_processor.setOption("output", &output_file, "Output File Name");
00034
00035
00036 command_line_processor.recogniseAllOptions(true);
00037
00038
00039 command_line_processor.throwExceptions(false);
00040
00041
00042 Teuchos::CommandLineProcessor::EParseCommandLineReturn parse_return =
00043 command_line_processor.parse(ac, av);
00044
00045 if (parse_return == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) {
00046 return 0;
00047 }
00048
00049 if (parse_return != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
00050 return 1;
00051 }
00052
00053
00054
00055
00056
00057 Teuchos::GlobalMPISession mpiSession(&ac, &av);
00058
00059 LCM::Topology topology(input_file, output_file);
00060
00061
00062
00063
00064
00065
00066 std::cout << "***********************" << std::endl;
00067 std::cout << "Before mesh subdivision" << std::endl;
00068 std::cout << "***********************" << std::endl;
00069
00070 LCM::display_connectivity(topology.getBulkData(), topology.getCellRank());
00071
00072
00073
00074 topology.removeNodeRelations();
00075
00076
00077 std::string gviz_output = LCM::parallelize_string("before") + ".dot";
00078 topology.outputToGraphviz(gviz_output);
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088 clock_t start, end;
00089 double cpu_time_used;
00090 start = clock();
00091
00092
00093 topology.barycentricSubdivision();
00094
00095 end = clock();
00096 cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
00097
00098 std::cout << "*************************" << std::endl;
00099 std::cout << "After element subdivision" << std::endl;
00100 std::cout << "*************************" << std::endl;
00101 gviz_output = LCM::parallelize_string("after") + ".dot";
00102 topology.outputToGraphviz(gviz_output);
00103
00104
00105
00106 topology.restoreElementToNodeConnectivity();
00107
00108 LCM::display_connectivity(topology.getBulkData(), topology.getCellRank());
00109
00110 std::cout << std::endl;
00111 std::cout << "topology.barycentricSubdivision() takes "
00112 << cpu_time_used << " seconds"<< std::endl;
00113
00114 Teuchos::RCP<Albany::AbstractDiscretization> discretization_ptr =
00115 topology.getDiscretization();
00116 Albany::STKDiscretization & stk_discretization =
00117 static_cast<Albany::STKDiscretization &>(*discretization_ptr);
00118
00119 Teuchos::RCP<Epetra_Vector> solution_field =
00120 stk_discretization.getSolutionField();
00121
00122
00123
00124
00125 stk_discretization.writeSolution(*solution_field, 1.0);
00126
00127 return 0;
00128
00129 }