79#define fei_file "beam.cpp"
85int main(
int argc,
char** argv)
88 int numProcs, localProc;
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;
195 factory->parameters(params);
198 factory->createVectorSpace(comm,
"beam");
202 factory->createMatrixGraph(nodeSpace, dummy,
"beam");
205 nodeSpace->setParameters(params);
206 matrixGraph->setParameters(params);
213 nodeSpace->defineFields( 1, &fieldID, &fieldSize );
214 nodeSpace->defineIDTypes(1, &nodeIDType );
215 nodeSpace->defineIDTypes(1, &crIDType );
225 init_shared_nodes( matrixGraph.
get(), hexcube ) );
227 int firstLocalCRID = 0;
228 if (slave_constraints) {
230 init_slave_constraints( matrixGraph.
get(), hexcube) );
234 init_constraints( matrixGraph.
get(), hexcube, localProc, firstLocalCRID) );
237 CHK_ERR( matrixGraph->initComplete() );
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;
266 factory->createLinearSystem(matrixGraph);
268 CHK_ERR( linSys->parameters(params));
270 linSys->setMatrix(mat);
271 linSys->setSolutionVector(solnVec);
272 linSys->setRHS(rhsVec);
280 if (!slave_constraints) {
282 load_constraints(linSys.
get(), hexcube, firstLocalCRID) );
285 CHK_ERR( linSys->loadComplete() );
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;
338 CHK_ERR( solnVec->scatterToOverlap() );
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 init_elem_connectivities(FEI *fei, PoissonData &poissonData)
int load_elem_data(FEI *fei, PoissonData &poissonData)
int main(int argc, char **argv)
virtual int numDofPerNode()
int getIntParamValue(const char *name, int ¶mValue) const
int getStringParamValue(const char *name, std::string ¶mValue) const
void parse_strings(std::vector< std::string > &stdstrings, const char *separator_string, fei::ParameterSet ¶mset)
int initialize_mpi(int argc, char **argv, int &localProc, int &numProcs)
int get_filename_and_read_input(int argc, char **argv, MPI_Comm comm, int localProc, std::vector< std::string > &stdstrings)
fei::SharedPtr< fei::Factory > create_fei_Factory(MPI_Comm comm, const char *libraryName)
std::ostream & console_out()