8 #ifndef _snl_fei_Factory_cpp_
9 #define _snl_fei_Factory_cpp_
11 #include <fei_macros.hpp>
13 #include <snl_fei_Factory.hpp>
29 if (wrapper_.get() != NULL) {
30 lsc_ = wrapper->getLinearSystemCore();
31 feData_ = wrapper->getFiniteElementData();
58 nodeIDType_(nodeIDType),
77 if (wrapper_.get() != NULL) {
80 else if (lsc_.get() != NULL) {
83 else if (feData_.get() != NULL) {
97 if (lsc_.get() != NULL || feData_.get() != NULL) {
99 const char** paramStrings = NULL;
100 std::vector<std::string> stdstrings;
103 char** nc_paramStrings =
const_cast<char**
>(paramStrings);
104 if (lsc_.get() != NULL) {
105 err += lsc_->parameters(numParams, nc_paramStrings);
107 if (feData_.get() != NULL) {
108 err += feData_->parameters(numParams, nc_paramStrings);
111 delete [] paramStrings;
114 FEI_OSTRINGSTREAM osstr;
115 osstr <<
"snl_fei::Factory::parameters received err="<<err
116 <<
" from either feiData_->parameters or lsc_->parameters.";
117 throw std::runtime_error(osstr.str());
126 param = parameterset.
get(
"BLOCK_GRAPH");
127 ptype = param != NULL ? param->
getType() : fei::Param::BAD_TYPE;
128 if (ptype != fei::Param::BAD_TYPE) {
132 param = parameterset.
get(
"BLOCK_MATRIX");
133 ptype = param != NULL ? param->
getType() : fei::Param::BAD_TYPE;
134 if (ptype != fei::Param::BAD_TYPE) {
135 if (ptype == fei::Param::BOOL) {
143 param = parameterset.
get(
"AZ_matrix_type");
144 ptype = param != NULL ? param->
getType() : fei::Param::BAD_TYPE;
145 if (ptype != fei::Param::BAD_TYPE) {
146 if (ptype == fei::Param::STRING) {
162 return(matrixGraph_);
172 if (matrixGraph_.get() == NULL) {
173 fei::console_out() <<
"snl_fei::Factory ERROR: when using LinearSystemCore or FiniteElementData"
174 <<
", you must create a MatrixGraph before you can create vectors"<<FEI_ENDL;
178 if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 &&
179 reducer_.get() == NULL) {
180 reducer_ = matrixGraph_->getReducer();
183 createBroker(matrixGraph_);
185 return( broker_->createVector() );
191 bool isSolutionVector,
196 if (matrixGraph_.get() == NULL) {
198 <<
", you must create a MatrixGraph before you can create vectors"<<FEI_ENDL;
202 if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 &&
203 reducer_.get() == NULL) {
204 reducer_ = matrixGraph_->getReducer();
207 createBroker(matrixGraph_);
209 return( broker_->createVector(isSolutionVector) );
217 matrixGraph_ = matrixGraph;
219 if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 &&
220 reducer_.get() == NULL) {
224 createBroker(matrixGraph_);
226 return( broker_->createVector() );
232 bool isSolutionVector,
235 matrixGraph_ = matrixGraph;
237 if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 &&
238 reducer_.get() == NULL) {
242 createBroker(matrixGraph_);
244 return( broker_->createVector(isSolutionVector) );
251 matrixGraph_ = matrixGraph;
254 if (matrixGraph_.get() == NULL) {
256 <<
", you must create a MatrixGraph before you can create matrices"<<FEI_ENDL;
260 if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 &&
261 reducer_.get() == NULL) {
262 reducer_ = matrixGraph_->getReducer();
265 createBroker(matrixGraph_);
267 broker_->setMatrixGraph(matrixGraph);
269 return(broker_->createMatrix());
276 matrixGraph_ = matrixGraph;
278 if (matrixGraph_.get() == NULL) {
279 fei::console_out() <<
"snl_fei::Factory ERROR: you may not create a LinearSystem with "
280 <<
"a NULL MatrixGraph object." << FEI_ENDL;
285 if (matrixGraph_->getGlobalNumSlaveConstraints() > 0 &&
286 reducer_.get() == NULL) {
287 reducer_ = matrixGraph_->getReducer();
290 createBroker(matrixGraph_);
292 broker_->setMatrixGraph(matrixGraph);
294 return( broker_->createLinearSystem() );
315 return(outputLevel_);
323 if (lsc_.get() != NULL) {
324 err = createBroker_LinSysCore(matrixGraph, lsc_);
326 if (feData_.get() != NULL) {
327 err = createBroker_FEData(matrixGraph, feData_);
338 if (broker_.get() == NULL) {
351 if (broker_.get() == NULL) {
void strings_to_char_ptrs(std::vector< std::string > &stdstrings, int &numStrings, const char **&charPtrs)
ParamType getType() const
const Param * get(const char *name) const
void convert_ParameterSet_to_strings(const fei::ParameterSet *paramset, std::vector< std::string > ¶mStrings)
virtual void parameters(const fei::ParameterSet ¶mset)
Factory(MPI_Comm comm, fei::SharedPtr< LibraryWrapper > wrapper)
bool getBoolValue() const
virtual fei::SharedPtr< fei::Reducer > getReducer()=0
virtual fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > columnSpace, const char *name)
fei::SharedPtr< LibraryWrapper > get_LibraryWrapper() const
fei::SharedPtr< fei::Factory > clone() const
virtual fei::SharedPtr< fei::LinearSystem > createLinearSystem(fei::SharedPtr< fei::MatrixGraph > &matrixGraph)
virtual fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > columnSpace, const char *name)
std::ostream & console_out()
const std::string & getStringValue() const
virtual void parameters(const fei::ParameterSet ¶meterset)
int getOutputLevel() const
virtual fei::SharedPtr< fei::Matrix > createMatrix(fei::SharedPtr< fei::MatrixGraph > matrixGraph)
virtual fei::SharedPtr< fei::Solver > createSolver(const char *name=0)
virtual fei::SharedPtr< fei::Vector > createVector(fei::SharedPtr< fei::VectorSpace > vecSpace, int numVectors=1)
int getIntParamValue(const char *name, int ¶mValue) const