• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

TopologyBase.cc

Go to the documentation of this file.
00001 //*****************************************************************//
00002 //    Albany 2.0:  Copyright 2012 Sandia Corporation               //
00003 //    This Software is released under the BSD license detailed     //
00004 //    in the file "license.txt" in the top-level Albany directory  //
00005 //*****************************************************************//
00006 
00007 //
00008 // Test of topology manipulation.
00009 //
00010 #include "topology/Topology.h"
00011 #include "topology/Topology_Utils.h"
00012 
00013 int main(int ac, char* av[])
00014 {
00015   // Create a command line processor and parse command line options
00016   Teuchos::CommandLineProcessor
00017   command_line_processor;
00018 
00019   command_line_processor.setDocString("Test topology manipulation.\n");
00020 
00021   std::string
00022   input_file = "input.e";
00023 
00024   command_line_processor.setOption(
00025                                    "input",
00026                                    &input_file,
00027                                    "Input File Name");
00028 
00029   std::string
00030   output_file = "output.e";
00031 
00032   command_line_processor.setOption(
00033                                    "output",
00034                                    &output_file,
00035                                    "Output File Name");
00036 
00037   // Throw a warning and not error for unrecognized options
00038   command_line_processor.recogniseAllOptions(true);
00039 
00040   // Don't throw exceptions for errors
00041   command_line_processor.throwExceptions(false);
00042 
00043   // Parse command line
00044   Teuchos::CommandLineProcessor::EParseCommandLineReturn
00045   parse_return = command_line_processor.parse(ac, av);
00046 
00047   if (parse_return == Teuchos::CommandLineProcessor::PARSE_HELP_PRINTED) {
00048     return 0;
00049   }
00050 
00051   if (parse_return != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL) {
00052     return 1;
00053   }
00054 
00055   //
00056   // Read the mesh
00057   //
00058   Teuchos::GlobalMPISession
00059   mpiSession(&ac,&av);
00060 
00061   LCM::Topology
00062   topology(input_file, output_file);
00063 
00064   topology.createBoundary();
00065   topology.outputBoundary();
00066 
00067   std::string
00068   gviz_filename_uu = LCM::parallelize_string("output-uu") + ".dot";
00069   topology.outputToGraphviz(
00070       gviz_filename_uu,
00071       LCM::Topology::UNIDIRECTIONAL_UNILEVEL);
00072 
00073   std::string
00074   gviz_filename_um = LCM::parallelize_string("output-um") + ".dot";
00075   topology.outputToGraphviz(
00076       gviz_filename_um,
00077       LCM::Topology::UNDIRECTIONAL_MULTILEVEL);
00078 
00079   std::string
00080   gviz_filename_bu = LCM::parallelize_string("output-bu") + ".dot";
00081   topology.outputToGraphviz(
00082       gviz_filename_bu,
00083       LCM::Topology::BIDIRECTIONAL_UNILEVEL);
00084 
00085   std::string
00086   gviz_filename_bm = LCM::parallelize_string("output-bm") + ".dot";
00087   topology.outputToGraphviz(
00088       gviz_filename_bm,
00089       LCM::Topology::BIDIRECTIONAL_MULTILEVEL);
00090 
00091   Teuchos::RCP<Albany::AbstractDiscretization>
00092   discretization_ptr = topology.getDiscretization();
00093 
00094   Albany::STKDiscretization &
00095   stk_discretization =
00096       static_cast<Albany::STKDiscretization &>(*discretization_ptr);
00097 
00098   // Need solution for output call
00099   Teuchos::RCP<Epetra_Vector>
00100   solution_field = stk_discretization.getSolutionField();
00101 
00102   // second arg to output is (pseudo)time
00103   stk_discretization.writeSolution(*solution_field, 1.0);
00104 
00105   return 0;
00106 }
00107 
00108 
00109 
00110 

Generated on Wed Mar 26 2014 18:36:45 for Albany: a Trilinos-based PDE code by  doxygen 1.7.1