Sierra Toolkit Version of the Day
UseCaseMain.cpp
00001 /*------------------------------------------------------------------------*/
00002 /*                 Copyright 2010 Sandia Corporation.                     */
00003 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00004 /*  license for use of this work by or on behalf of the U.S. Government.  */
00005 /*  Export of this program may require a license from the                 */
00006 /*  United States Government.                                             */
00007 /*------------------------------------------------------------------------*/
00008 
00009 #include <iostream>
00010 
00011 #include <use_cases/UseCase_Rebal_1.hpp>
00012 #include <use_cases/UseCase_Rebal_2.hpp>
00013 #include <use_cases/UseCase_Rebal_3.hpp>
00014 #include <use_cases/UseCase_Rebal_4.hpp>
00015 
00016 #include <stk_util/parallel/Parallel.hpp>
00017 #include <stk_util/parallel/ParallelReduce.hpp>
00018 #include <stk_util/use_cases/UseCaseEnvironment.hpp>
00019 
00020 #include <stk_mesh/base/Trace.hpp>
00021 
00022 #include <stk_rebalance/Rebalance.hpp>
00023 
00024 void printStatus(bool status)
00025 {
00026   if (status) {
00027     std::cout << "passed" << std::endl;
00028   }
00029   else {
00030     std::cout << "FAILED" << std::endl;
00031   }
00032 }
00033 
00034 int main ( int argc, char * argv[] )
00035 {
00036   use_case::UseCaseEnvironment use_case_environment(&argc, &argv);
00037   stk::ParallelMachine parallel_machine = use_case_environment.m_comm;
00038 
00039   bool status = true;
00040   {
00041     std::cout << "Use Case 1, unequal element weights ... ";
00042     bool local_status = stk::rebalance::use_cases::test_unequal_weights(parallel_machine);
00043     stk::all_reduce(parallel_machine, stk::ReduceMin<1>(&local_status));
00044     printStatus(local_status);
00045     status = status && local_status;
00046   }
00047   {
00048     std::cout << "Use Case 2, heavy entities ... ";
00049     bool local_status = stk::rebalance::use_cases::test_heavy_nodes(parallel_machine);
00050     stk::all_reduce(parallel_machine, stk::ReduceMin<1>(&local_status));
00051     printStatus(local_status);
00052     status = status && local_status;
00053   }
00054 
00055   {
00056     std::cout << "Use Case 3, contact surfaces ... ";
00057     bool local_status = stk::rebalance::use_cases::test_contact_surfaces(parallel_machine);
00058     stk::all_reduce(parallel_machine, stk::ReduceMin<1>(&local_status));
00059     printStatus(local_status);
00060     status = status && local_status;
00061   }
00062   {
00063     std::cout << "Use Case 4, greedy sideset ... ";
00064     bool local_status = stk::rebalance::use_cases::test_greedy_sideset(parallel_machine);
00065     stk::all_reduce(parallel_machine, stk::ReduceMin<1>(&local_status));
00066     printStatus(local_status);
00067     status = status && local_status;
00068   }
00069 
00070   bool collective_result = use_case::print_status(parallel_machine, status);
00071   int return_code = collective_result ? 0 : -1;
00072 
00073   return return_code;
00074 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines