872 std::cout <<
"Running Test__ElasticBeam3D_LoadFunction" << std::endl;
875 std::string OrgDir, TestDir;
876 bool ItAllWorks =
true;
882 std::string suffix =
"/share/Testing/test_data/ElasticBeam3D_LoadFunction";
885 TestDir = IRAD::Sys::CWD() +
"/ElasticBeam3D_TestData";
890 std::cout <<
"ElasticBeam3D_LoadFunction Error: GetInputData call failed."
892 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
897 if(!IRAD::Sys::FILEEXISTS(TestDir)){
898 std::cout <<
"ElasticBeam3D_LoadFunction Error: Could not find directory, "
899 << TestDir <<
", for running tests." << std::endl;
900 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
905 OrgDir = IRAD::Sys::CWD();
908 IntDir = IRAD::Sys::ChDir(TestDir);
910 std::cout <<
"ElasticBeam3D_LoadFunction Error: Could not change directories to "
911 << TestDir <<
"." << std::endl;
912 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
918 COM_LOAD_MODULE_STATIC_DYNAMIC( ElmerCSC,
"Window1");
920 bool load_unload =
true;
923 int h=COM_get_window_handle(
"Window1");
925 std::cout <<
" After loading, COM_get_window_handle(\"Window1\") returns "
928 std::cout <<
"ElasticBeam3D_LoadFunction Error: Could not get window handle."
930 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
937 int init_handle = COM_get_function_handle(
"Window1.Initialize");
938 bool init_func = (init_handle > 0);
941 std::cout <<
"init = " << init_handle << std::endl;
944 COM_call_function(init_handle, &init_runs, &verb);
947 std::cout <<
"ElasticBeam3D_LoadFunction Error: Could not get function handle."
949 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
956 double* Loads = NULL;
958 bool loadsRegistered =
true, loadsInitialized =
true;
960 COM_get_array(
"Window1.Loads",11,&Loads);
962 COM_get_size(
"Window1.Loads",11,&LoadsSize);
963 std::cout <<
"Loads not NULL" << std::endl;
964 std::cout <<
"LoadsSize = " << LoadsSize << std::endl;
966 for(
int i=0; i < LoadsSize; i++){
967 for(
int j=0; j < 3; j++){
968 if(fabs(Loads[i*3 + j]) > 1.0e-12){
969 std::cout <<
"Loads were not intialized to 0.0!" << std::endl;
970 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
977 std::cout <<
"Loads are NULL" << std::endl;
978 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
986 int runs_handle = COM_get_function_handle(
"Window1.Run");
987 bool runs_func = (runs_handle > 0);
988 bool DispCorrect =
true;
992 std::cout <<
"runs = " << runs_handle << std::endl;
996 std::cout <<
"Changing load values" << std::endl;
997 for(
int i=0; i < LoadsSize; i++){
998 Loads[i*3 + 1] = -4.0e5;
999 for(
int j=0; j < 3; j++){
1000 std::cout << Loads[i*3 + j] <<
" ";
1002 std::cout << std::endl;
1005 COM_call_function(runs_handle, &runs_runs, &time1);
1008 std::cout <<
"ElasticBeam3D_LoadFunction Error: Could not get function handle."
1009 <<
"." << std::endl;
1010 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
1017 int final_handle = COM_get_function_handle(
"Window1.Finalize");
1018 bool final_func = (final_handle > 0);
1020 std::cout <<
"final = " << final_handle << std::endl;
1023 COM_call_function(final_handle, &final_runs);
1026 std::cout <<
"ElasticBeam3D_LoadFunction Error: Could not get function handle."
1027 <<
"." << std::endl;
1028 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
1037 std::ifstream Inf, InfComp;
1038 std::stringstream ss;
1039 std::string word, line;
1041 Inf.open(
"case.ep");
1042 InfComp.open(
"case.ep_check");
1044 std::getline(Inf,line);
1045 std::getline(Inf,line);
1046 std::getline(InfComp,line);
1047 std::getline(InfComp,line);
1049 bool LoadWorks =
true;
1050 int diffReturn = -1;
1055 std::cout <<
"ElasticBeam3D_LoadFunction Error: case.ep "
1056 <<
"case.ep_check differ!" << std::endl;
1057 std::cout << ss.str() << std::endl;
1062 std::cout <<
"LoadWorks = " << LoadWorks << std::endl;
1063 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Works",LoadWorks);
1067 COM_UNLOAD_MODULE_STATIC_DYNAMIC( ElmerCSC ,
"Window1");
1070 h=COM_get_window_handle(
"Window1");
1072 std::cout <<
"After unloading, COM_get_window_handle(\"Window1\") returns "
1075 std::cout <<
"ElasticBeam3D_LoadFunction Error: Did not properly unload module."
1076 <<
"." << std::endl;
1077 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
1082 IntDir = IRAD::Sys::ChDir(OrgDir);
1084 std::cout <<
"ElasticBeam3D_LoadFunction Error: Could not change directories to "
1085 << OrgDir <<
"." << std::endl;
1086 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
false);
1090 result.UpdateResult(
"ElasticBeam3D_LoadFunction:Runs",
true);
int streamdiff(std::istream &stream1, std::istream &stream2, std::stringstream *ss=NULL)
Function to compare two files.
virtual int GetInputData(std::string suffix, std::string TestDir)
Function to copy input data from source testing directory for use in unit tests.