FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_Factory.cpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #include <fei_macros.hpp>
10 
11 #include <fei_Factory.hpp>
12 #include <fei_LogManager.hpp>
13 #include <fei_LogFile.hpp>
14 #include <fei_ParameterSet.hpp>
15 
16 #include <FEI_Implementation.hpp>
17 #include <fei_FEI_Impl.hpp>
18 
19 //----------------------------------------------------------------------------
20 fei::Factory::Factory(MPI_Comm comm)
21 {
22  int numProcs = 1, localProc = 0;
23 #ifndef FEI_SER
24  MPI_Comm_size(comm, &numProcs);
25  MPI_Comm_rank(comm, &localProc);
26 #endif
28 }
29 
30 //----------------------------------------------------------------------------
32 {
35 }
36 
37 //----------------------------------------------------------------------------
38 void fei::Factory::parameters(const fei::ParameterSet& paramset)
39 {
40  const fei::Param* param = paramset.get("FEI_OUTPUT_PATH");
41  fei::Param::ParamType ptype = param != NULL ?
42  param->getType() : fei::Param::BAD_TYPE;
43  if (ptype == fei::Param::STRING) {
45  log_manager.setOutputPath(param->getStringValue().c_str());
46  }
47 
48  param = paramset.get("debugOutput");
49  ptype = param != NULL ? param->getType() : fei::Param::BAD_TYPE;
50  if (ptype == fei::Param::STRING) {
52  log_manager.setOutputPath(param->getStringValue().c_str());
53  }
54 
55  param = paramset.get("FEI_OUTPUT_LEVEL");
56  ptype = param != NULL ? param->getType() : fei::Param::BAD_TYPE;
57  if (ptype == fei::Param::STRING) {
59  log_manager.setOutputLevel(param->getStringValue().c_str());
60  }
61 }
62 
63 //----------------------------------------------------------------------------
66  MPI_Comm comm)
67 {
68  //fei::SharedPtr<FEI> fei(new fei::FEI_Impl(wrapper, comm));
69  fei::SharedPtr<FEI> fei(new FEI_Implementation(wrapper, comm));
70 
71  return(fei);
72 }
73 
74 //----------------------------------------------------------------------------
76 fei::Factory::createFEI(MPI_Comm comm)
77 {
78  fei::SharedPtr<FEI> fei(new fei::FEI_Impl(this, comm));
79 
80  return(fei);
81 }
82 
83 //----------------------------------------------------------------------------
84 
ParamType getType() const
Definition: fei_Param.hpp:98
const Param * get(const char *name) const
virtual void parameters(const fei::ParameterSet &paramset)
Definition: fei_Factory.cpp:38
void setNumProcs(int nprocs, int localproc)
void closeOutputStream()
Definition: fei_LogFile.cpp:62
void setOutputLevel(OutputLevel olevel)
virtual ~Factory()
Definition: fei_Factory.cpp:31
Factory(MPI_Comm comm)
Definition: fei_Factory.cpp:20
const std::string & getStringValue() const
Definition: fei_Param.hpp:104
int localProc(MPI_Comm comm)
static LogManager & getLogManager()
static LogFile & getLogFile()
Definition: fei_LogFile.cpp:68
virtual fei::SharedPtr< FEI > createFEI(fei::SharedPtr< LibraryWrapper > wrapper, MPI_Comm comm)
Definition: fei_Factory.cpp:65
void setOutputPath(const std::string &opath)
int numProcs(MPI_Comm comm)