37 #define fei_file "cube3.cpp"
48 std::vector<std::string> stdstrings;
55 std::string solverName;
56 std::string datasource;
57 std::string constraintform;
70 fei::console_out() <<
"Failed to find one or more required parameters in input-file."
81 bool slave_constraints =
false;
82 if (
"slaves" == constraintform) {
83 slave_constraints =
true;
87 if (datasource ==
"HexBeam") {
88 hexcubeptr =
new HexBeam(W, D, DofPerNode,
92 hexcubeptr =
new HexBeamCR(W, D, DofPerNode,
99 int numCRs = (W+1)*(W+1)* ((numProcs*2)-1);
102 FEI_COUT <<
"========================================================"
105 FEI_COUT <<
"--------------------------------------------------------"<<
FEI_ENDL;
106 FEI_COUT <<
"Size W: " << W <<
" (num-elements-along-side-of-cube)"<<
FEI_ENDL;
107 FEI_COUT <<
"Size D: " << D <<
" (num-elements-along-depth-of-cube)"<<
FEI_ENDL;
114 FEI_COUT <<
"========================================================"
128 if (factory.
get() == NULL) {
161 int firstLocalCRID = 0;
162 if (slave_constraints) {
175 if (localProc == 0) {
190 if (localProc == 0) {
192 FEI_COUT <<
"Create-Matrix cpu time: " << fei_creatematrix_time <<
FEI_ENDL;
214 if (!slave_constraints) {
223 if (localProc == 0) {
227 FEI_COUT <<
"Total assembly wall time: "
228 << fei_init_time + fei_creatematrix_time + fei_load_time <<
FEI_ENDL;
241 std::string solver_name_value;
244 const char* charptr_solvername =
245 solver_name_value.empty() ? 0 : solver_name_value.c_str();
255 int err = solver->
solve(linSys.
get(),
264 if (localProc==0)
FEI_COUT <<
"solve returned err: " << err <<
", status: "
282 FEI_COUT <<
"Proc0 cpu times (seconds):" << FEI_ENDL
283 <<
" FEI initialize: " << fei_init_time << FEI_ENDL
284 <<
" FEI create-matrix: " << fei_creatematrix_time << FEI_ENDL
285 <<
" FEI load: " << fei_load_time << FEI_ENDL
286 <<
" solve: " << solve_time << FEI_ENDL
287 <<
"Total program time: " << elapsed_cpu_time <<
FEI_ENDL;
289 #if defined(FEI_PLATFORM) && defined(FEI_OPT_LEVEL)
290 double benchmark = fei_init_time;
292 std::string slavestr;
293 if (!constraintform.empty()) {
294 slavestr = constraintform;
296 if (slavestr.size() > 0) slavestr +=
"_";
299 testname_init <<
"cube3_init_"<<slavestr<<W<<
"_"<<D<<
"_"<<DofPerNode<<
"_"
300 <<solverName<<
"_np"<<numProcs<<
"_"
301 <<FEI_PLATFORM<<
"_"<<FEI_OPT_LEVEL;
303 testname_create <<
"cube3_creatematrix_"<<slavestr<<W<<
"_"<<D<<
"_"<<DofPerNode
304 <<
"_"<<solverName<<
"_np"<<numProcs<<
"_"
305 <<FEI_PLATFORM<<
"_"<<FEI_OPT_LEVEL;
307 testname_load <<
"cube3_load_"<<slavestr<<W<<
"_"<<D<<
"_"<<DofPerNode<<
"_"
308 <<solverName<<
"_np"<<numProcs<<
"_"
309 <<FEI_PLATFORM<<
"_"<<FEI_OPT_LEVEL;
311 double file_init, file_create, file_load;
312 bool file_benchmarks_available =
true;
315 testname_init.str().c_str());
317 testname_create.str().c_str());
319 testname_load.str().c_str());
321 catch (std::runtime_error& exc) {
322 file_benchmarks_available =
false;
325 if (file_benchmarks_available) {
327 bool init_test_passed =
331 benchmark = fei_creatematrix_time;
332 bool create_test_passed =
336 benchmark = fei_load_time;
337 bool load_test_passed =
341 returnValue = init_test_passed&&create_test_passed&&load_test_passed ? 0 : 1;
347 bool testPassed = returnValue==0;
348 if (testPassed && localProc == 0) {
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
double get_file_benchmark(const char *filename, const char *testname)
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 beam_main(int argc, char **argv, MPI_Comm comm, int numProcs, int localProc)
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
#define FEI_OSTRINGSTREAM
int numProcs(MPI_Comm comm)
int getIntParamValue(const char *name, int ¶mValue) const
bool check_and_cout_test_result(std::string testname, double value, double file_value, unsigned margin)