Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include <Teuchos_TestForException.hpp>
00008
00009 #include "AAdapt_AdaptationFactory.hpp"
00010 #include "AAdapt_CopyRemesh.hpp"
00011 #if defined(ALBANY_LCM) && defined(LCM_SPECULATIVE)
00012 #include "AAdapt_TopologyModification.hpp"
00013 #include "AAdapt_RandomFracture.hpp"
00014 #endif
00015 #if defined(ALBANY_LCM) && defined(ALBANY_STK_PERCEPT)
00016 #include "AAdapt_STKAdapt.hpp"
00017 #endif
00018 #ifdef ALBANY_SCOREC
00019 #include "AAdapt_MeshAdapt.hpp"
00020 #endif
00021
00022 namespace AAdapt {
00023
00024
00025 AAdapt::AdaptationFactory::
00026 AdaptationFactory(const Teuchos::RCP<Teuchos::ParameterList>& adapt_params,
00027 const Teuchos::RCP<ParamLib>& param_lib,
00028 Albany::StateManager& state_mgr,
00029 const Teuchos::RCP<const Epetra_Comm>& comm) :
00030 adapt_params_(adapt_params),
00031 param_lib_(param_lib),
00032 state_mgr_(state_mgr),
00033 epetra_comm_(comm) {
00034 }
00035
00036 Teuchos::RCP<AAdapt::AbstractAdapter>
00037 AAdapt::AdaptationFactory::createAdapter() {
00038 using Teuchos::rcp;
00039
00040 Teuchos::RCP<AAdapt::AbstractAdapter> strategy;
00041 std::string& method = adapt_params_->get("Method", "");
00042
00043 if(method == "Copy Remesh") {
00044 strategy = rcp(new AAdapt::CopyRemesh(adapt_params_,
00045 param_lib_,
00046 state_mgr_,
00047 epetra_comm_));
00048 }
00049
00050 #if defined(ALBANY_LCM) && defined(LCM_SPECULATIVE)
00051
00052 else if(method == "Topmod") {
00053 strategy = rcp(new AAdapt::TopologyMod(adapt_params_,
00054 param_lib_,
00055 state_mgr_,
00056 epetra_comm_));
00057 }
00058
00059 else if(method == "Random") {
00060 strategy = rcp(new AAdapt::RandomFracture(adapt_params_,
00061 param_lib_,
00062 state_mgr_,
00063 epetra_comm_));
00064 }
00065
00066 #endif
00067 #ifdef ALBANY_SCOREC
00068
00069 else if(method == "RPI Unif Size") {
00070 strategy = rcp(new AAdapt::MeshAdapt<AAdapt::UnifSizeField>(adapt_params_, param_lib_, state_mgr_, epetra_comm_));
00071 }
00072
00073 else if(method == "RPI UnifRef Size") {
00074 strategy = rcp(new AAdapt::MeshAdapt<AAdapt::UnifRefSizeField>(adapt_params_, param_lib_, state_mgr_, epetra_comm_));
00075 }
00076
00077 #ifdef SCOREC_SPR
00078 else if(method == "RPI SPR Size") {
00079 strategy = rcp(new AAdapt::MeshAdapt<AAdapt::SPRSizeField>(adapt_params_, param_lib_, state_mgr_, epetra_comm_));
00080 }
00081 #endif
00082
00083 #endif
00084 #if defined(ALBANY_LCM) && defined(ALBANY_STK_PERCEPT)
00085
00086 else if(method == "Unif Size") {
00087 strategy = rcp(new AAdapt::STKAdapt<AAdapt::STKUnifRefineField>(adapt_params_,
00088 param_lib_,
00089 state_mgr_,
00090 epetra_comm_));
00091 }
00092
00093 #endif
00094
00095 else {
00096 TEUCHOS_TEST_FOR_EXCEPTION(true,
00097 Teuchos::Exceptions::InvalidParameter,
00098 std::endl <<
00099 "Error! Unknown adaptivity method requested:"
00100 << method <<
00101 " !" << std::endl
00102 << "Supplied parameter list is " <<
00103 std::endl << *adapt_params_);
00104 }
00105
00106 return strategy;
00107 }
00108
00109 }