79 #define fei_file "beam.cpp"
85 int main(
int argc,
char** argv)
96 std::vector<std::string> stdstrings;
104 std::string solverName;
105 std::string datasource;
106 std::string constraintform;
119 fei::console_out() <<
"Failed to find one or more required parameters in input-file."
120 << std::endl <<
"Required parameters:"<<std::endl
121 <<
"SOLVER_LIBRARY" << std::endl
122 <<
"DATA_SOURCE" << std::endl
123 <<
"CONSTRAINT_FORM" << std::endl
124 <<
"W" << std::endl <<
"D" << std::endl <<
"DofPerNode" << std::endl;
135 bool slave_constraints = (constraintform ==
"slaves");
138 if (datasource ==
"HexBeam") {
139 hexcubeptr =
new HexBeam(W, D, DofPerNode,
143 hexcubeptr =
new HexBeamCR(W, D, DofPerNode,
147 HexBeam& hexcube = *hexcubeptr;
149 if (localProc == 0) {
150 int numCRs = (W+1)*(W+1)* ((numProcs*2)-1);
154 std::cout << std::endl;
155 std::cout <<
"========================================================\n";
157 std::cout <<
"--------------------------------------------------------\n";
158 std::cout <<
"Size W: " << W <<
" (num-elements-along-side-of-cube)\n";
159 std::cout <<
"Size D: " << D <<
" (num-elements-along-depth-of-cube)\n";
160 std::cout <<
"DOF per node: " << DofPerNode <<
"\n";
161 std::cout <<
"Num local elements: " << hexcube.
localNumElems_ <<
"\n";
162 std::cout <<
"Num global elements: " << hexcube.
totalNumElems_ <<
"\n";
163 std::cout <<
"Num local DOF: " << hexcube.
numLocalDOF_ <<
"\n";
164 std::cout <<
"Num global DOF: " << hexcube.
numGlobalDOF_ <<
"\n";
165 std::cout <<
"Num global CRs: " << numCRs <<
"\n";
166 std::cout <<
"========================================================"
177 std::cout <<
"library " << solverName <<
" not available."<<std::endl;
185 if (factory.
get() == NULL) {
186 std::cout <<
"fei::Factory allocation failed." << std::endl;
227 int firstLocalCRID = 0;
228 if (slave_constraints) {
241 if (localProc == 0) {
243 std::cout <<
"Initialization cpu time: " << fei_init_time << std::endl;
256 if (localProc == 0) {
258 std::cout <<
"Create-Matrix cpu time: " << fei_creatematrix_time << std::endl;
280 if (!slave_constraints) {
289 if (localProc == 0) {
292 std::cout <<
"Coef. loading cpu time: " << fei_load_time << std::endl;
293 std::cout <<
"Total assembly wall time: "
294 << fei_init_time + fei_creatematrix_time + fei_load_time << std::endl;
307 std::string solver_name_value;
310 const char* charptr_solvername =
311 solver_name_value.empty() ? NULL : solver_name_value.c_str();
318 if (localProc==0) std::cout <<
"solve..." << std::endl;
321 int err = solver->
solve(linSys.
get(),
329 if (err!=0 && localProc==0) {
330 std::cout <<
"solve returned err: " << err <<
", status: "
331 << status << std::endl;
335 std::cout <<
" cpu-time in solve: " << solve_time << std::endl;
347 std::cout <<
"Proc0 cpu times (seconds):" << std::endl
348 <<
" FEI initialize: " << fei_init_time << std::endl
349 <<
" FEI create-matrix: " << fei_creatematrix_time << std::endl
350 <<
" FEI load: " << fei_load_time << std::endl
351 <<
" solve: " << solve_time << std::endl
352 <<
"Total program time: " << elapsed_cpu_time << std::endl;
int load_constraints(FEI *fei, HexBeam &hexcube, int firstLocalCRID)
virtual void setMatrix(fei::SharedPtr< fei::Matrix > &matrix)
virtual fei::SharedPtr< fei::Solver > createSolver(const char *name=0)=0
virtual void setParameters(const fei::ParameterSet ¶ms)=0
fei::SharedPtr< fei::Factory > create_fei_Factory(MPI_Comm comm, const char *libraryName)
virtual int parameters(int numParams, const char *const *paramStrings)=0
virtual void parameters(const fei::ParameterSet ¶mset)
int init_slave_constraints(fei::MatrixGraph *matrixGraph, HexBeam &hexcube)
virtual void setSolutionVector(fei::SharedPtr< fei::Vector > &soln)
virtual fei::SharedPtr< fei::LinearSystem > createLinearSystem(fei::SharedPtr< fei::MatrixGraph > &matrixGraph)
void defineFields(int numFields, const int *fieldIDs, const int *fieldSizes, const int *fieldTypes=NULL)
virtual void setRHS(fei::SharedPtr< fei::Vector > &rhs)
virtual int scatterToOverlap()=0
int init_constraints(FEI *fei, HexBeam &hexcube, int &firstLocalCRID)
virtual int loadComplete(bool applyBCs=true, bool globalAssemble=true)=0
void setParameters(const fei::ParameterSet ¶mset)
virtual fei::SharedPtr< VectorSpace > createVectorSpace(MPI_Comm, const char *name)
int init_elem_connectivities(FEI *fei, HexBeam &hexcube)
int load_elem_data(FEI *fei, HexBeam &hexcube)
int getStringParamValue(const char *name, std::string ¶mValue) const
int get_filename_and_read_input(int argc, char **argv, MPI_Comm comm, int localProc, std::vector< std::string > &stdstrings)
virtual int initComplete()=0
virtual int numDofPerNode()
int init_shared_nodes(FEI *fei, HexBeam &hexcube)
void defineIDTypes(int numIDTypes, const int *idTypes)
int initialize_mpi(int argc, char **argv, int &localProc, int &numProcs)
virtual fei::SharedPtr< fei::Vector > createVector(fei::SharedPtr< fei::VectorSpace > vecSpace, int numVectors=1)=0
std::ostream & console_out()
void parse_strings(std::vector< std::string > &stdstrings, const char *separator_string, fei::ParameterSet ¶mset)
int localProc(MPI_Comm comm)
virtual int solve(fei::LinearSystem *linearSystem, fei::Matrix *preconditioningMatrix, const fei::ParameterSet ¶meterSet, int &iterationsTaken, int &status)
virtual fei::SharedPtr< fei::Matrix > createMatrix(fei::SharedPtr< fei::MatrixGraph > matrixGraph)=0
virtual fei::SharedPtr< fei::MatrixGraph > createMatrixGraph(fei::SharedPtr< fei::VectorSpace > rowSpace, fei::SharedPtr< fei::VectorSpace > columnSpace, const char *name)=0
int main(int argc, char **argv)
int numProcs(MPI_Comm comm)
int getIntParamValue(const char *name, int ¶mValue) const