73 #define fei_file "beam_oldfei.cpp"
79 int main(
int argc,
char** argv)
86 std::vector<std::string> stdstrings;
91 const char** params = NULL;
99 std::string solverName;
100 std::string datasource;
114 fei::console_out() <<
"Failed to find one or more required parameters in input-file."
115 << std::endl <<
"Required parameters:"<<std::endl
116 <<
"SOLVER_LIBRARY" << std::endl
117 <<
"DATA_SOURCE" << std::endl
118 <<
"WHICH_FEI" << std::endl
119 <<
"W" << std::endl <<
"D" << std::endl <<
"DofPerNode" << std::endl;
124 if (datasource ==
"HexBeam") {
125 hexcubeptr =
new HexBeam(W, D, DofPerNode,
129 hexcubeptr =
new HexBeamCR(W, D, DofPerNode,
133 HexBeam& hexcube = *hexcubeptr;
135 if (localProc == 0) {
136 int numCRs = (W+1)*(W+1)*(numProcs*2)-1;
138 std::cout << std::endl;
139 std::cout <<
"========================================================"
141 std::cout <<
"Size W: " << W <<
" (num-elements-along-side-of-cube)"<<std::endl;
142 std::cout <<
"Size D: " << D <<
" (num-elements-along-depth-of-cube)"<<std::endl;
143 std::cout <<
"DOF per node: " << DofPerNode <<std::endl;
144 std::cout <<
"Num local elements: " << hexcube.
localNumElems_ << std::endl;
145 std::cout <<
"Num global elements: " << hexcube.
totalNumElems_ << std::endl;
146 std::cout <<
"Num local DOF: " << hexcube.
numLocalDOF_ << std::endl;
147 std::cout <<
"Num global DOF: " << hexcube.
numGlobalDOF_ << std::endl;
148 std::cout <<
"Num global CRs: " << numCRs << std::endl;
149 std::cout <<
"========================================================"
161 if (whichFEI ==
"OLDFEI") {
165 catch (std::runtime_error& exc) {
171 else if (whichFEI ==
"fei::FEI_Impl") {
175 catch (std::runtime_error& exc) {
182 fei::console_out() <<
"beam ERROR, value of 'WHICH_FEI' must be 'OLDFEI' or 'fei::FEI_Impl'"<< std::endl;
210 if (localProc == 0) {
212 std::cout <<
"Initialization time: " << fei_init_time << std::endl;
235 if (localProc == 0) {
238 std::cout <<
"Coef. loading time: " << fei_load_time << std::endl;
239 std::cout <<
"Total assembly time: " << fei_init_time + fei_load_time << std::endl;
251 err = fei->
solve(status);
254 if (localProc==0) std::cout <<
"solve returned status: " << status << std::endl;
259 if (localProc == 0) {
260 std::cout <<
"Solver time: " << solve_time << std::endl;
264 if (localProc == 0) {
265 #if defined(FEI_PLATFORM) && defined(FEI_OPT_LEVEL)
266 double benchmark = fei_init_time;
269 testname_init <<
"cube_"<<whichFEI<<
"_init_"<<W<<
"_"<<D<<
"_"<<DofPerNode<<
"_"
270 <<solverName<<
"_np"<<numProcs<<
"_"
271 <<FEI_PLATFORM<<
"_"<<FEI_OPT_LEVEL;
274 testname_load <<
"cube_"<<whichFEI<<
"_load_"<<W<<
"_"<<D<<
"_"<<DofPerNode<<
"_"
275 <<solverName<<
"_np"<<numProcs<<
"_"
276 <<FEI_PLATFORM<<
"_"<<FEI_OPT_LEVEL;
278 double file_init, file_load;
279 bool file_benchmarks_available =
true;
282 testname_init.str().c_str());
284 testname_load.str().c_str());
286 catch (std::runtime_error& exc) {
287 file_benchmarks_available =
false;
290 if (file_benchmarks_available) {
292 bool init_test_passed =
296 benchmark = fei_load_time;
297 bool load_test_passed =
301 returnValue = init_test_passed&&load_test_passed ? 0 : 1;
306 bool testPassed = returnValue==0;
307 if (testPassed && localProc == 0) {
309 std::cout <<
"beam execution successful" << std::endl;
int load_constraints(FEI *fei, HexBeam &hexcube, int firstLocalCRID)
void strings_to_char_ptrs(std::vector< std::string > &stdstrings, int &numStrings, const char **&charPtrs)
virtual int parameters(int numParams, const char *const *paramStrings)=0
virtual int initComplete()=0
fei::SharedPtr< fei::Factory > create_fei_Factory(MPI_Comm comm, const char *libraryName)
virtual int solve(int &status)=0
#define FEI_Implementation
int init_constraints(FEI *fei, HexBeam &hexcube, int &firstLocalCRID)
int init_elem_connectivities(FEI *fei, HexBeam &hexcube)
#define FEI_SINGLE_SYSTEM
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 numDofPerNode()
virtual int initFields(int numFields, const int *fieldSizes, const int *fieldIDs, const int *fieldTypes=NULL)=0
int init_shared_nodes(FEI *fei, HexBeam &hexcube)
int initialize_mpi(int argc, char **argv, int &localProc, int &numProcs)
virtual int setSolveType(int solveType)=0
std::ostream & console_out()
void parse_strings(std::vector< std::string > &stdstrings, const char *separator_string, fei::ParameterSet ¶mset)
virtual int loadComplete(bool applyBCs=true, bool globalAssemble=true)=0
int localProc(MPI_Comm comm)
virtual fei::SharedPtr< FEI > createFEI(fei::SharedPtr< LibraryWrapper > wrapper, MPI_Comm comm)
int main(int argc, char **argv)
#define FEI_OSTRINGSTREAM
fei::SharedPtr< LibraryWrapper > create_LibraryWrapper(MPI_Comm comm, const char *libraryName)
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)