Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include "Albany_MORDiscretizationUtils.hpp"
00008
00009 #include "Albany_ProblemFactory.hpp"
00010 #include "Albany_AbstractProblem.hpp"
00011
00012 #include "Teuchos_RCP.hpp"
00013 #include "Teuchos_ParameterList.hpp"
00014
00015 namespace Albany {
00016
00017 void
00018 setupInternalMeshStruct(
00019 DiscretizationFactory &discFactory,
00020 const Teuchos::RCP<Teuchos::ParameterList> &problemParams,
00021 const Teuchos::RCP<const Epetra_Comm> &epetraComm)
00022 {
00023 const Teuchos::RCP<ParamLib> paramLib(new ParamLib);
00024 ProblemFactory problemFactory(problemParams, paramLib, epetraComm);
00025 const Teuchos::RCP<AbstractProblem> problem = problemFactory.create();
00026 problemParams->validateParameters(*problem->getValidProblemParameters(), 0);
00027
00028 StateManager stateMgr;
00029 const Teuchos::ArrayRCP<Teuchos::RCP<MeshSpecsStruct> > meshSpecs =
00030 discFactory.createMeshSpecs();
00031 problem->buildProblem(meshSpecs, stateMgr);
00032
00033 discFactory.setupInternalMeshStruct(
00034 problem->numEquations(),
00035 stateMgr.getStateInfoStruct(),
00036 problem->getFieldRequirements());
00037 }
00038
00039 Teuchos::RCP<AbstractDiscretization>
00040 createDiscretization(DiscretizationFactory &discFactory)
00041 {
00042 return discFactory.createDiscretizationFromInternalMeshStruct(Teuchos::null);
00043 }
00044
00045 Teuchos::RCP<AbstractDiscretization>
00046 discretizationNew(
00047 const Teuchos::RCP<Teuchos::ParameterList> &topLevelParams,
00048 const Teuchos::RCP<const Epetra_Comm> &epetraComm)
00049 {
00050 const bool sublistMustExist = true;
00051 const Teuchos::RCP<Teuchos::ParameterList> problemParams =
00052 Teuchos::sublist(topLevelParams, "Problem", sublistMustExist);
00053
00054 DiscretizationFactory discFactory(topLevelParams, epetraComm);
00055 setupInternalMeshStruct(discFactory, problemParams, epetraComm);
00056 return createDiscretization(discFactory);
00057 }
00058
00059 Teuchos::RCP<AbstractDiscretization>
00060 modifiedDiscretizationNew(
00061 const Teuchos::RCP<Teuchos::ParameterList> &topLevelParams,
00062 const Teuchos::RCP<const Epetra_Comm> &epetraComm,
00063 DiscretizationTransformation &transformation)
00064 {
00065 const bool sublistMustExist = true;
00066 const Teuchos::RCP<Teuchos::ParameterList> problemParams =
00067 Teuchos::sublist(topLevelParams, "Problem", sublistMustExist);
00068
00069 DiscretizationFactory discFactory(topLevelParams, epetraComm);
00070 setupInternalMeshStruct(discFactory, problemParams, epetraComm);
00071
00072 transformation(discFactory);
00073
00074 return createDiscretization(discFactory);
00075 }
00076
00077 }