1 #ifndef __OPENFOAMMODULEDRIVER_TEST_H__
13 #define __OPENFOAMMODULEDRIVER_TEST_H__
14 #ifdef _OPENFOAMMODULEDRIVER_PARALLEL_
22 #include "com_devel.hpp"
23 #include "UnixUtils.H"
28 namespace OpenFoamModuleDriver {
33 namespace TestFixture {
39 double F1(
double x) {
return (2.0*x); };
45 double F2(
double x) {
return (3.0*x*x); };
75 template<
typename ResultsType>
124 for(
int i = 10;i < 10000000;i*=10)
N.push_back(i);
132 double F1(
double x) {
return (2.0*x); };
138 double F2(
double x) {
return (3.0*x*x); };
151 OrgDir = IRAD::Sys::CWD();
154 if(!IRAD::Sys::FILEEXISTS(sourceDir)){
155 std::cout <<
"GetInputData Error: Could not find data directory, "
156 << sourceDir <<
". Exiting (fail)." << std::endl;
162 std::string InFileName;
163 std::string OutFileName;
168 if(!IRAD::Sys::FILEEXISTS(destDir)){
169 IntDir = IRAD::Sys::CreateDirectory(destDir);
171 std::cout <<
"GetInputData Error: Could not make directory, "
172 << destDir <<
". Exiting (fail)." << std::endl;
178 IRAD::Sys::Directory SourceDir(sourceDir);
181 IntDir = IRAD::Sys::ChDir(destDir);
183 std::cout <<
"GetInputData Error: Could not change directories to "
184 << destDir <<
". Exiting (fail)." << std::endl;
189 for(std::vector<std::string>::iterator it = SourceDir.begin();
190 it != SourceDir.end(); ++it){
191 InFileName = sourceDir +
"/" + *it;
192 OutFileName = IRAD::Sys::CWD() +
"/" + *it;
194 if(IRAD::Sys::ISLINK(InFileName))
196 int IntDir = IRAD::Sys::SymLink(InFileName, OutFileName);
197 else if(IRAD::Sys::ISDIR(InFileName)) {
202 Inf.open(InFileName.c_str());
203 Ouf.open(OutFileName.c_str());
211 IntDir = IRAD::Sys::ChDir(OrgDir);
213 std::cout <<
"GetInputData Error: Could not change directories to "
214 << OrgDir <<
". Exiting (fail)." << std::endl;
228 std::cout <<
"Running Test__ModuleLoad" << std::endl;
231 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
235 int h=COM_get_window_handle(
"OFModule");
237 std::cout <<
" After loading, COM_get_window_handle(\"OFModule\") returns "
239 std::cout <<
"ModuleLoadUnload Error: Could not get window handle."
245 result.UpdateResult(
"LoadSolverModule:Works",works);
250 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
254 h=COM_get_window_handle(
"OFModule");
256 std::cout <<
"After unloading, COM_get_window_handle(\"OFModule\") returns "
258 std::cout <<
"ModuleLoadUnload Error: Did not properly unload module."
264 result.UpdateResult(
"UnloadSolverModule:Works",works);
275 std::cout <<
"Running Test__LoadUnitTestData" << std::endl;
279 std::string suffix =
"/share/Testing/test_data/HronTurekFsi";
283 std::string TestDir = IRAD::Sys::CWD() +
"/UnitTestData";
288 std::cout <<
"LoadUnitTestData Error: GetInputData call failed."
290 result.UpdateResult(
"LoadUnitTestData:Works",
false);
295 if(!IRAD::Sys::FILEEXISTS(TestDir)){
296 std::cout <<
"LoadUnitTestData Error: Could not find directory, "
297 << TestDir <<
", for running tests." << std::endl;
298 result.UpdateResult(
"LoadUnitTestData:Works",
false);
303 std::string OrgDir = IRAD::Sys::CWD();
306 IntDir = IRAD::Sys::ChDir(TestDir);
308 std::cout <<
"LoadUnitTestData Error: Could not change directories to "
309 << TestDir <<
"." << std::endl;
310 result.UpdateResult(
"LoadUnitTestData:Works",
false);
313 result.UpdateResult(
"LoadUnitTestData:Works",
true);
315 IntDir = IRAD::Sys::ChDir(OrgDir);
326 std::cout <<
"Running Test__ModuleFunctionInitialize" << std::endl;
329 std::cout <<
"Before loading OFModule" << std::endl;
330 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
331 std::cout <<
"After loading OFModule" << std::endl;
335 int initHandle = COM_get_function_handle(
"OFModule.InitFoam");
339 std::cout <<
"ModuleFunctionInitialize Error: Could not get function handle."
342 result.UpdateResult(
"InitFunction:Exists",works);
347 std::string suffix =
"/share/Testing/test_data/HronTurekFsi";
349 std::string testDir = IRAD::Sys::CWD() +
"/UnitTestDataHTFsi";
351 std::string fluidDir = testDir +
"/fluid";
352 std::string OrgDir = IRAD::Sys::CWD();
353 IntDir = IRAD::Sys::ChDir(fluidDir);
361 dummy2[0] =
const_cast<char *
>(std::string(
"functionInit").c_str());
363 COM_call_function(initHandle, &dummy1, &dummy2, &verb);
366 int* initStatus=NULL;
367 int status = COM_get_status(
"OFModule.initStatus",101);
369 std::cout <<
"ModuleFunctionInitialize Error: initStatus not a valid DataItem."
370 <<
"status = " << status << std::endl;
374 COM_get_array(
"OFModule.initStatus", 101, &initStatus);
380 std::cout <<
"ModuleFunctionInitialize Error: initStatus not set to zero by InitFoam."
383 result.UpdateResult(
"InitFunction:Runs",works);
386 IntDir = IRAD::Sys::ChDir(OrgDir);
387 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
401 std::cout <<
"Running Test__ModuleSurfaceData" << std::endl;
404 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
407 std::string suffix =
"/share/Testing/test_data/HronTurekFsi";
409 std::string testDir = IRAD::Sys::CWD() +
"/UnitTestDataSurfaceData";
411 std::string fluidDir = testDir +
"/fluid";
412 std::string OrgDir = IRAD::Sys::CWD();
413 IntDir = IRAD::Sys::ChDir(fluidDir);
418 dummy2[0] =
const_cast<char *
>(std::string(
"DataReg").c_str());
421 int initHandle = COM_get_function_handle(
"OFModule.InitFoam");
422 COM_call_function(initHandle, &dummy1, &dummy2, &verb);
427 COM_get_panes(
"OFModule", &numPanes, &paneList);
430 int pane = paneList[0];
433 int status = COM_get_status(
"OFModule.pressure", pane);
435 std::cout <<
"ModuleSurfaceData Error: pressure not a valid DataItem. "
436 <<
"status = " << status << std::endl;
437 result.UpdateResult(
"PressureData:Registered",
false);
440 result.UpdateResult(
"PressureData:Registered",
true);
445 COM_Type getDataItemType;
446 int getDataItemComponents;
447 std::string getDataItemUnits;
448 COM_get_dataitem(
"OFModule.pressure", &getDataItemLoc, &getDataItemType,
449 &getDataItemComponents, &getDataItemUnits);
451 double* pressure=NULL;
452 COM_get_array(
"OFModule.pressure", pane, &pressure);
458 bool pressureCorrect =
false;
460 int numPresExpected = 168;
461 int numPresCompExpected = 1;
462 COM_get_size(
"OFModule.pressure", pane, &numPres);
464 if (numPres != numPresExpected || numPresCompExpected != getDataItemComponents) {
465 std::cout <<
"Wrong number of pressures registered for this mesh." << std::endl;
466 std::cout <<
"Got " << numPres <<
" Items, Expected: " << numPresExpected << std::endl;
467 std::cout <<
"Got " << getDataItemComponents <<
" Components, Expected: "
468 << numPresCompExpected << std::endl;
470 pressureCorrect =
true;
475 status = COM_get_status(
"OFModule.traction", pane);
477 std::cout <<
"ModuleSurfaceData Error: traction not a valid DataItem."
478 <<
"status = " << status << std::endl;
479 result.UpdateResult(
"TractionData:Registered",
false);
482 result.UpdateResult(
"TractionData:Registered",
true);
485 COM_get_dataitem(
"OFModule.traction", &getDataItemLoc, &getDataItemType,
486 &getDataItemComponents, &getDataItemUnits);
488 double* traction=NULL;
489 COM_get_array(
"OFModule.traction", pane, &traction);
494 bool tractionCorrect =
false;
496 int numTracExpected = 168;
497 int numTracCompExpected = 3;
498 COM_get_size(
"OFModule.traction", pane, &numTrac);
500 if (numTrac != numTracExpected || numTracCompExpected != getDataItemComponents) {
501 std::cout <<
"Wrong number of tractions registered for this mesh." << std::endl;
502 std::cout <<
"Got " << numTrac <<
" Items, Expected: " << numTracExpected << std::endl;
503 std::cout <<
"Got " << getDataItemComponents <<
" Components, Expected: "
504 << numTracCompExpected << std::endl;
506 tractionCorrect =
true;
511 int stepHandle = COM_get_function_handle(
"OFModule.StepFluid");
512 COM_call_function(stepHandle);
520 std::cout <<
"ModuleSurfaceData Error: pressure incorrect "
523 result.UpdateResult(
"PressureData:Correct", pressureCorrect);
524 result.UpdateResult(
"TractionData:Correct", tractionCorrect);
527 IntDir = IRAD::Sys::ChDir(OrgDir);
529 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
544 std::cout <<
"Running Test__ModuleFunctionStepFluid" << std::endl;
547 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
553 std::string suffix =
"/share/Testing/test_data/HronTurekFsi";
555 std::string testDir = IRAD::Sys::CWD() +
"/UnitTestDataStepTest";
557 std::string fluidDir = testDir +
"/fluid";
558 std::string OrgDir = IRAD::Sys::CWD();
559 IntDir = IRAD::Sys::ChDir(fluidDir);
564 dummy2[0] =
const_cast<char *
>(std::string(
"StepFluid").c_str());
567 int initHandle = COM_get_function_handle(
"OFModule.InitFoam");
568 COM_call_function(initHandle, &dummy1, &dummy2, &verb);
573 COM_get_panes(
"OFModule", &numPanes, &paneList);
576 int pane = paneList[0];
579 int status = COM_get_status(
"OFModule.time", pane);
580 bool timeStatus =
false;
582 std::cout <<
"ModuleFunctionStepFluid Error: time not a valid DataItem."
583 <<
"status = " << status << std::endl;
584 result.UpdateResult(
"TimeData:Registered",
false);
590 status = COM_get_status(
"OFModule.endTime", pane);
592 std::cout <<
"ModuleFunctionStepFluid Error: endTime not a valid DataItem."
593 <<
"status = " << status << std::endl;
594 result.UpdateResult(
"TimeData:Registered",
false);
597 timeStatus = timeStatus &&
true;
599 result.UpdateResult(
"TimeData:Registered", timeStatus);
602 COM_get_array(
"OFModule.time", pane, &time);
603 double* endTime=NULL;
604 COM_get_array(
"OFModule.endTime", pane, &endTime);
607 double testTime = 0.;
608 double testEndTime = 5.e-3;
609 double toler = 1.e-9;
610 if(*time - testTime < toler && *endTime - testEndTime < toler)
613 std::cout <<
"ModuleFunctionStepFluid Error: time or endTime initialized incorrectly"
615 std::cout <<
" time = " << *time <<
" expected " << testTime << std::endl;
616 std::cout <<
" endTime = " << *endTime <<
" expected " << testEndTime << std::endl;
618 result.UpdateResult(
"TimeData:Correct",works);
622 int stepHandle = COM_get_function_handle(
"OFModule.StepFluid");
626 std::cout <<
"ModuleFunctionStepFluid Error: Could not get function handle."
628 result.UpdateResult(
"StepFluidFunction:Exists",
false);
631 result.UpdateResult(
"StepFluidFunction:Exists",works);
635 COM_call_function(stepHandle);
641 if(*time - testTime < toler )
644 std::cout <<
"ModuleFunctionStepFluid Error: time did not increment"
646 std::cout <<
" time = " << *time <<
"expected " << testTime << std::endl;
648 result.UpdateResult(
"StepFluidFunction:Steps",works);
651 IntDir = IRAD::Sys::ChDir(OrgDir);
653 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
664 std::cout <<
"Running Test__ModuleMeshRegistration" << std::endl;
667 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
670 int initHandle = COM_get_function_handle(
"OFModule.InitFoam");
673 std::string suffix =
"/share/Testing/test_data/HronTurekFsi";
675 std::string testDir = IRAD::Sys::CWD() +
"/UnitTestDataMeshTest";
677 std::string fluidDir = testDir +
"/fluid";
678 std::string OrgDir = IRAD::Sys::CWD();
679 IntDir = IRAD::Sys::ChDir(fluidDir);
684 dummy2[0] =
const_cast<char *
>(std::string(
"meshReg").c_str());
687 COM_call_function(initHandle, &dummy1, &dummy2, &verb);
692 COM_get_dataitems(
"OFModule", &numDataItems, output);
693 std::istringstream Istr(output);
694 std::vector<std::string> dataItemNames;
696 for (
int i=0; i<numDataItems; ++i) {
699 dataItemNames.push_back(name);
700 std::cout <<
"DataItem # " << i <<
": " << name << std::endl;
706 COM_get_panes(
"OFModule", &numPanes, &paneList);
707 std::cout <<
"Number of Panes " << numPanes << std::endl;
708 for (
int i=0; i<numPanes; ++i)
709 std::cout <<
"Pane ID # " << i+1 <<
"=" << paneList[i] << std::endl;
712 int pane = paneList[0];
717 bool coordCorrect =
false;
719 COM_get_array(
"OFModule.nc", pane, &Coord);
721 std::cout <<
"In Test__ModuleMeshRegistration: No mesh coordinates registered."
725 result.UpdateResult(
"CoordinateData:Registered",
true);
730 int numNodesExpected = 338;
731 COM_get_size(
"OFModule.nc", pane, &numNodes);
733 if (numNodes != numNodesExpected) {
734 std::cout <<
"Wrong number of nodes registered for this mesh." << std::endl;
735 std::cout <<
"Got " << numNodes <<
" Expected: " << numNodesExpected << std::endl;
743 double CoordCheck[338][3] =
745 { {0.299528, 0.21, -0.025334},
746 {0.299528, 0.21, 0.025334},
747 {0.295179, 0.21, 0.025334},
748 {0.295179, 0.21, -0.025334},
749 {0.291124, 0.21, 0.025334},
750 {0.291124, 0.21, -0.025334},
751 {0.287343, 0.21, 0.025334},
752 {0.287343, 0.21, -0.025334},
753 {0.283818, 0.21, 0.025334},
754 {0.283818, 0.21, -0.025334},
755 {0.280531, 0.21, 0.025334},
756 {0.280531, 0.21, -0.025334},
757 {0.277466, 0.21, 0.025334},
758 {0.277466, 0.21, -0.025334},
759 {0.274609, 0.21, 0.025334},
760 {0.274609, 0.21, -0.025334},
761 {0.271945, 0.21, 0.025334},
762 {0.271945, 0.21, -0.025334},
763 {0.26946, 0.21, 0.025334},
764 {0.26946, 0.21, -0.025334},
765 {0.267144, 0.21, 0.025334},
766 {0.267144, 0.21, -0.025334},
767 {0.264984, 0.21, 0.025334},
768 {0.264984, 0.21, -0.025334},
769 {0.262971, 0.21, 0.025334},
770 {0.262971, 0.21, -0.025334},
771 {0.261093, 0.21, 0.025334},
772 {0.261093, 0.21, -0.025334},
773 {0.259343, 0.21, 0.025334},
774 {0.259343, 0.21, -0.025334},
775 {0.25771, 0.21, 0.025334},
776 {0.25771, 0.21, -0.025334},
777 {0.256188, 0.21, 0.025334},
778 {0.256188, 0.21, -0.025334},
779 {0.254769, 0.21, 0.025334},
780 {0.254769, 0.21, -0.025334},
781 {0.253446, 0.21, 0.025334},
782 {0.253446, 0.21, -0.025334},
783 {0.252213, 0.21, 0.025334},
784 {0.252213, 0.21, -0.025334},
785 {0.251062, 0.21, 0.025334},
786 {0.251062, 0.21, -0.025334},
787 {0.24999, 0.21, 0.025334},
788 {0.24999, 0.21, -0.025334},
789 {0.24899, 0.21, 0.025334},
790 {0.24899, 0.21, -0.025334},
791 {0.295179, 0.19, 0.025334},
792 {0.299528, 0.19, 0.025334},
793 {0.299528, 0.19, -0.025334},
794 {0.295179, 0.19, -0.025334},
795 {0.291124, 0.19, 0.025334},
796 {0.291124, 0.19, -0.025334},
797 {0.287343, 0.19, 0.025334},
798 {0.287343, 0.19, -0.025334},
799 {0.283818, 0.19, 0.025334},
800 {0.283818, 0.19, -0.025334},
801 {0.280531, 0.19, 0.025334},
802 {0.280531, 0.19, -0.025334},
803 {0.277466, 0.19, 0.025334},
804 {0.277466, 0.19, -0.025334},
805 {0.274609, 0.19, 0.025334},
806 {0.274609, 0.19, -0.025334},
807 {0.271945, 0.19, 0.025334},
808 {0.271945, 0.19, -0.025334},
809 {0.26946, 0.19, 0.025334},
810 {0.26946, 0.19, -0.025334},
811 {0.267144, 0.19, 0.025334},
812 {0.267144, 0.19, -0.025334},
813 {0.264984, 0.19, 0.025334},
814 {0.264984, 0.19, -0.025334},
815 {0.262971, 0.19, 0.025334},
816 {0.262971, 0.19, -0.025334},
817 {0.261093, 0.19, 0.025334},
818 {0.261093, 0.19, -0.025334},
819 {0.259343, 0.19, 0.025334},
820 {0.259343, 0.19, -0.025334},
821 {0.25771, 0.19, 0.025334},
822 {0.25771, 0.19, -0.025334},
823 {0.256188, 0.19, 0.025334},
824 {0.256188, 0.19, -0.025334},
825 {0.254769, 0.19, 0.025334},
826 {0.254769, 0.19, -0.025334},
827 {0.253446, 0.19, 0.025334},
828 {0.253446, 0.19, -0.025334},
829 {0.252213, 0.19, 0.025334},
830 {0.252213, 0.19, -0.025334},
831 {0.251062, 0.19, 0.025334},
832 {0.251062, 0.19, -0.025334},
833 {0.24999, 0.19, 0.025334},
834 {0.24999, 0.19, -0.025334},
835 {0.24899, 0.19, -0.025334},
836 {0.24899, 0.19, 0.025334},
837 {0.6, 0.19, -0.025334},
838 {0.6, 0.19, 0.025334},
839 {0.6, 0.195, 0.025334},
840 {0.6, 0.195, -0.025334},
841 {0.6, 0.2, 0.025334},
842 {0.6, 0.2, -0.025334},
843 {0.6, 0.205, 0.025334},
844 {0.6, 0.205, -0.025334},
845 {0.6, 0.21, 0.025334},
846 {0.6, 0.21, -0.025334},
847 {0.594992, 0.21, 0.025334},
848 {0.594992, 0.21, -0.025334},
849 {0.589984, 0.21, 0.025334},
850 {0.589984, 0.21, -0.025334},
851 {0.584976, 0.21, 0.025334},
852 {0.584976, 0.21, -0.025334},
853 {0.579969, 0.21, 0.025334},
854 {0.579969, 0.21, -0.025334},
855 {0.574961, 0.21, 0.025334},
856 {0.574961, 0.21, -0.025334},
857 {0.569953, 0.21, 0.025334},
858 {0.569953, 0.21, -0.025334},
859 {0.564945, 0.21, 0.025334},
860 {0.564945, 0.21, -0.025334},
861 {0.559937, 0.21, 0.025334},
862 {0.559937, 0.21, -0.025334},
863 {0.554929, 0.21, 0.025334},
864 {0.554929, 0.21, -0.025334},
865 {0.549921, 0.21, 0.025334},
866 {0.549921, 0.21, -0.025334},
867 {0.544913, 0.21, 0.025334},
868 {0.544913, 0.21, -0.025334},
869 {0.539906, 0.21, 0.025334},
870 {0.539906, 0.21, -0.025334},
871 {0.534898, 0.21, 0.025334},
872 {0.534898, 0.21, -0.025334},
873 {0.52989, 0.21, 0.025334},
874 {0.52989, 0.21, -0.025334},
875 {0.524882, 0.21, 0.025334},
876 {0.524882, 0.21, -0.025334},
877 {0.519874, 0.21, 0.025334},
878 {0.519874, 0.21, -0.025334},
879 {0.514866, 0.21, 0.025334},
880 {0.514866, 0.21, -0.025334},
881 {0.509858, 0.21, 0.025334},
882 {0.509858, 0.21, -0.025334},
883 {0.50485, 0.21, 0.025334},
884 {0.50485, 0.21, -0.025334},
885 {0.499843, 0.21, 0.025334},
886 {0.499843, 0.21, -0.025334},
887 {0.494835, 0.21, 0.025334},
888 {0.494835, 0.21, -0.025334},
889 {0.489827, 0.21, 0.025334},
890 {0.489827, 0.21, -0.025334},
891 {0.484819, 0.21, 0.025334},
892 {0.484819, 0.21, -0.025334},
893 {0.479811, 0.21, 0.025334},
894 {0.479811, 0.21, -0.025334},
895 {0.474803, 0.21, 0.025334},
896 {0.474803, 0.21, -0.025334},
897 {0.469795, 0.21, 0.025334},
898 {0.469795, 0.21, -0.025334},
899 {0.464787, 0.21, 0.025334},
900 {0.464787, 0.21, -0.025334},
901 {0.45978, 0.21, 0.025334},
902 {0.45978, 0.21, -0.025334},
903 {0.454772, 0.21, 0.025334},
904 {0.454772, 0.21, -0.025334},
905 {0.449764, 0.21, 0.025334},
906 {0.449764, 0.21, -0.025334},
907 {0.444756, 0.21, 0.025334},
908 {0.444756, 0.21, -0.025334},
909 {0.439748, 0.21, 0.025334},
910 {0.439748, 0.21, -0.025334},
911 {0.43474, 0.21, 0.025334},
912 {0.43474, 0.21, -0.025334},
913 {0.429732, 0.21, 0.025334},
914 {0.429732, 0.21, -0.025334},
915 {0.424724, 0.21, 0.025334},
916 {0.424724, 0.21, -0.025334},
917 {0.419717, 0.21, 0.025334},
918 {0.419717, 0.21, -0.025334},
919 {0.414709, 0.21, 0.025334},
920 {0.414709, 0.21, -0.025334},
921 {0.409701, 0.21, 0.025334},
922 {0.409701, 0.21, -0.025334},
923 {0.404693, 0.21, 0.025334},
924 {0.404693, 0.21, -0.025334},
925 {0.399685, 0.21, 0.025334},
926 {0.399685, 0.21, -0.025334},
927 {0.394677, 0.21, 0.025334},
928 {0.394677, 0.21, -0.025334},
929 {0.389669, 0.21, 0.025334},
930 {0.389669, 0.21, -0.025334},
931 {0.384661, 0.21, 0.025334},
932 {0.384661, 0.21, -0.025334},
933 {0.379654, 0.21, 0.025334},
934 {0.379654, 0.21, -0.025334},
935 {0.374646, 0.21, 0.025334},
936 {0.374646, 0.21, -0.025334},
937 {0.369638, 0.21, 0.025334},
938 {0.369638, 0.21, -0.025334},
939 {0.36463, 0.21, 0.025334},
940 {0.36463, 0.21, -0.025334},
941 {0.359622, 0.21, 0.025334},
942 {0.359622, 0.21, -0.025334},
943 {0.354614, 0.21, 0.025334},
944 {0.354614, 0.21, -0.025334},
945 {0.349606, 0.21, 0.025334},
946 {0.349606, 0.21, -0.025334},
947 {0.344599, 0.21, 0.025334},
948 {0.344599, 0.21, -0.025334},
949 {0.339591, 0.21, 0.025334},
950 {0.339591, 0.21, -0.025334},
951 {0.334583, 0.21, 0.025334},
952 {0.334583, 0.21, -0.025334},
953 {0.329575, 0.21, 0.025334},
954 {0.329575, 0.21, -0.025334},
955 {0.324567, 0.21, 0.025334},
956 {0.324567, 0.21, -0.025334},
957 {0.319559, 0.21, 0.025334},
958 {0.319559, 0.21, -0.025334},
959 {0.314551, 0.21, 0.025334},
960 {0.314551, 0.21, -0.025334},
961 {0.309543, 0.21, 0.025334},
962 {0.309543, 0.21, -0.025334},
963 {0.304536, 0.21, 0.025334},
964 {0.304536, 0.21, -0.025334},
965 {0.304536, 0.19, 0.025334},
966 {0.304536, 0.19, -0.025334},
967 {0.309543, 0.19, 0.025334},
968 {0.309543, 0.19, -0.025334},
969 {0.314551, 0.19, 0.025334},
970 {0.314551, 0.19, -0.025334},
971 {0.319559, 0.19, 0.025334},
972 {0.319559, 0.19, -0.025334},
973 {0.324567, 0.19, 0.025334},
974 {0.324567, 0.19, -0.025334},
975 {0.329575, 0.19, 0.025334},
976 {0.329575, 0.19, -0.025334},
977 {0.334583, 0.19, 0.025334},
978 {0.334583, 0.19, -0.025334},
979 {0.339591, 0.19, 0.025334},
980 {0.339591, 0.19, -0.025334},
981 {0.344599, 0.19, 0.025334},
982 {0.344599, 0.19, -0.025334},
983 {0.349606, 0.19, 0.025334},
984 {0.349606, 0.19, -0.025334},
985 {0.354614, 0.19, 0.025334},
986 {0.354614, 0.19, -0.025334},
987 {0.359622, 0.19, 0.025334},
988 {0.359622, 0.19, -0.025334},
989 {0.36463, 0.19, 0.025334},
990 {0.36463, 0.19, -0.025334},
991 {0.369638, 0.19, 0.025334},
992 {0.369638, 0.19, -0.025334},
993 {0.374646, 0.19, 0.025334},
994 {0.374646, 0.19, -0.025334},
995 {0.379654, 0.19, 0.025334},
996 {0.379654, 0.19, -0.025334},
997 {0.384661, 0.19, 0.025334},
998 {0.384661, 0.19, -0.025334},
999 {0.389669, 0.19, 0.025334},
1000 {0.389669, 0.19, -0.025334},
1001 {0.394677, 0.19, 0.025334},
1002 {0.394677, 0.19, -0.025334},
1003 {0.399685, 0.19, 0.025334},
1004 {0.399685, 0.19, -0.025334},
1005 {0.404693, 0.19, 0.025334},
1006 {0.404693, 0.19, -0.025334},
1007 {0.409701, 0.19, 0.025334},
1008 {0.409701, 0.19, -0.025334},
1009 {0.414709, 0.19, 0.025334},
1010 {0.414709, 0.19, -0.025334},
1011 {0.419717, 0.19, 0.025334},
1012 {0.419717, 0.19, -0.025334},
1013 {0.424724, 0.19, 0.025334},
1014 {0.424724, 0.19, -0.025334},
1015 {0.429732, 0.19, 0.025334},
1016 {0.429732, 0.19, -0.025334},
1017 {0.43474, 0.19, 0.025334},
1018 {0.43474, 0.19, -0.025334},
1019 {0.439748, 0.19, 0.025334},
1020 {0.439748, 0.19, -0.025334},
1021 {0.444756, 0.19, 0.025334},
1022 {0.444756, 0.19, -0.025334},
1023 {0.449764, 0.19, 0.025334},
1024 {0.449764, 0.19, -0.025334},
1025 {0.454772, 0.19, 0.025334},
1026 {0.454772, 0.19, -0.025334},
1027 {0.45978, 0.19, 0.025334},
1028 {0.45978, 0.19, -0.025334},
1029 {0.464787, 0.19, 0.025334},
1030 {0.464787, 0.19, -0.025334},
1031 {0.469795, 0.19, 0.025334},
1032 {0.469795, 0.19, -0.025334},
1033 {0.474803, 0.19, 0.025334},
1034 {0.474803, 0.19, -0.025334},
1035 {0.479811, 0.19, 0.025334},
1036 {0.479811, 0.19, -0.025334},
1037 {0.484819, 0.19, 0.025334},
1038 {0.484819, 0.19, -0.025334},
1039 {0.489827, 0.19, 0.025334},
1040 {0.489827, 0.19, -0.025334},
1041 {0.494835, 0.19, 0.025334},
1042 {0.494835, 0.19, -0.025334},
1043 {0.499843, 0.19, 0.025334},
1044 {0.499843, 0.19, -0.025334},
1045 {0.50485, 0.19, 0.025334},
1046 {0.50485, 0.19, -0.025334},
1047 {0.509858, 0.19, 0.025334},
1048 {0.509858, 0.19, -0.025334},
1049 {0.514866, 0.19, 0.025334},
1050 {0.514866, 0.19, -0.025334},
1051 {0.519874, 0.19, 0.025334},
1052 {0.519874, 0.19, -0.025334},
1053 {0.524882, 0.19, 0.025334},
1054 {0.524882, 0.19, -0.025334},
1055 {0.52989, 0.19, 0.025334},
1056 {0.52989, 0.19, -0.025334},
1057 {0.534898, 0.19, 0.025334},
1058 {0.534898, 0.19, -0.025334},
1059 {0.539906, 0.19, 0.025334},
1060 {0.539906, 0.19, -0.025334},
1061 {0.544913, 0.19, 0.025334},
1062 {0.544913, 0.19, -0.025334},
1063 {0.549921, 0.19, 0.025334},
1064 {0.549921, 0.19, -0.025334},
1065 {0.554929, 0.19, 0.025334},
1066 {0.554929, 0.19, -0.025334},
1067 {0.559937, 0.19, 0.025334},
1068 {0.559937, 0.19, -0.025334},
1069 {0.564945, 0.19, 0.025334},
1070 {0.564945, 0.19, -0.025334},
1071 {0.569953, 0.19, 0.025334},
1072 {0.569953, 0.19, -0.025334},
1073 {0.574961, 0.19, 0.025334},
1074 {0.574961, 0.19, -0.025334},
1075 {0.579969, 0.19, 0.025334},
1076 {0.579969, 0.19, -0.025334},
1077 {0.584976, 0.19, 0.025334},
1078 {0.584976, 0.19, -0.025334},
1079 {0.589984, 0.19, 0.025334},
1080 {0.589984, 0.19, -0.025334},
1081 {0.594992, 0.19, 0.025334},
1082 {0.594992, 0.19, -0.025334} };
1085 for(
int i=0; i < numNodes; i++) {
1086 for(
int j=0; j < 3; j++){
1087 if(fabs(CoordCheck[i][j] - Coord[i*3+j]) > 1.0e-6){
1088 coordCorrect =
false;
1089 std::cout <<
"Incorrect coordinate value for node=" << i
1090 <<
" index " << j <<
" Expected " << CoordCheck[i][j]
1091 <<
" Got " << Coord[i*3+j] << std::endl;
1095 result.UpdateResult(
"CoordinateData:Correct", coordCorrect);
1100 bool connCorrect =
true;
1104 std::string stringNames;
1105 COM_get_connectivities(
"OFModule", pane, &numConn, stringNames);
1106 std::istringstream ConnISS(stringNames);
1107 std::vector<std::string> connNames;
1109 for (
int i=0; i<numConn; ++i) {
1112 connNames.push_back(name);
1113 std::cout <<
"Connectivity Table # " << i+1 <<
": " << name << std::endl;
1117 char getDataItemLoc;
1118 COM_Type getDataItemType;
1119 int numElementNodes;
1120 std::string getDataItemUnits;
1121 std::string fullConnName(
"OFModule."+connNames[0]);
1122 COM_get_dataitem(fullConnName, &getDataItemLoc, &getDataItemType,
1123 &numElementNodes, &getDataItemUnits);
1125 std::cout <<
"getDataItemLoc " << getDataItemLoc << std::endl;
1126 std::cout <<
"getDataItemType " << getDataItemType << std::endl;
1127 std::cout <<
"numElementNodes " << numElementNodes << std::endl;
1128 std::cout <<
"getDataItemUnits " << getDataItemUnits << std::endl;
1131 COM_get_array(fullConnName.c_str(), pane, &Conn);
1134 std::cout <<
"In Test__ModuleMeshRegistration: No mesh connectivity registered."
1138 result.UpdateResult(
"ConnectivityData:Registered",
true);
1143 int numElemExpected = 168;
1144 COM_get_size(fullConnName, pane, &numElem);
1146 if (numElem != numElemExpected) {
1147 std::cout <<
"Wrong number of elements registered for this mesh." << std::endl;
1148 std::cout <<
"Got " << numElem <<
" Expected: " << numElemExpected << std::endl;
1153 int ConnCheck[168][4] =
1201 {100, 99, 101, 102},
1202 {101, 103, 104, 102},
1203 {103, 105, 106, 104},
1204 {105, 107, 108, 106},
1205 {107, 109, 110, 108},
1206 {109, 111, 112, 110},
1207 {111, 113, 114, 112},
1208 {113, 115, 116, 114},
1209 {115, 117, 118, 116},
1210 {117, 119, 120, 118},
1211 {119, 121, 122, 120},
1212 {121, 123, 124, 122},
1213 {123, 125, 126, 124},
1214 {125, 127, 128, 126},
1215 {127, 129, 130, 128},
1216 {129, 131, 132, 130},
1217 {131, 133, 134, 132},
1218 {133, 135, 136, 134},
1219 {135, 137, 138, 136},
1220 {137, 139, 140, 138},
1221 {139, 141, 142, 140},
1222 {141, 143, 144, 142},
1223 {143, 145, 146, 144},
1224 {145, 147, 148, 146},
1225 {147, 149, 150, 148},
1226 {149, 151, 152, 150},
1227 {151, 153, 154, 152},
1228 {153, 155, 156, 154},
1229 {155, 157, 158, 156},
1230 {157, 159, 160, 158},
1231 {159, 161, 162, 160},
1232 {161, 163, 164, 162},
1233 {163, 165, 166, 164},
1234 {165, 167, 168, 166},
1235 {167, 169, 170, 168},
1236 {169, 171, 172, 170},
1237 {171, 173, 174, 172},
1238 {173, 175, 176, 174},
1239 {175, 177, 178, 176},
1240 {177, 179, 180, 178},
1241 {179, 181, 182, 180},
1242 {181, 183, 184, 182},
1243 {183, 185, 186, 184},
1244 {185, 187, 188, 186},
1245 {187, 189, 190, 188},
1246 {189, 191, 192, 190},
1247 {191, 193, 194, 192},
1248 {193, 195, 196, 194},
1249 {195, 197, 198, 196},
1250 {197, 199, 200, 198},
1251 {199, 201, 202, 200},
1252 {201, 203, 204, 202},
1253 {203, 205, 206, 204},
1254 {205, 207, 208, 206},
1255 {207, 209, 210, 208},
1256 {209, 211, 212, 210},
1257 {211, 213, 214, 212},
1258 {213, 215, 216, 214},
1259 {215, 217, 218, 216},
1260 {217, 219, 220, 218},
1263 {221, 223, 224, 222},
1264 {223, 225, 226, 224},
1265 {225, 227, 228, 226},
1266 {227, 229, 230, 228},
1267 {229, 231, 232, 230},
1268 {231, 233, 234, 232},
1269 {233, 235, 236, 234},
1270 {235, 237, 238, 236},
1271 {237, 239, 240, 238},
1272 {239, 241, 242, 240},
1273 {241, 243, 244, 242},
1274 {243, 245, 246, 244},
1275 {245, 247, 248, 246},
1276 {247, 249, 250, 248},
1277 {249, 251, 252, 250},
1278 {251, 253, 254, 252},
1279 {253, 255, 256, 254},
1280 {255, 257, 258, 256},
1281 {257, 259, 260, 258},
1282 {259, 261, 262, 260},
1283 {261, 263, 264, 262},
1284 {263, 265, 266, 264},
1285 {265, 267, 268, 266},
1286 {267, 269, 270, 268},
1287 {269, 271, 272, 270},
1288 {271, 273, 274, 272},
1289 {273, 275, 276, 274},
1290 {275, 277, 278, 276},
1291 {277, 279, 280, 278},
1292 {279, 281, 282, 280},
1293 {281, 283, 284, 282},
1294 {283, 285, 286, 284},
1295 {285, 287, 288, 286},
1296 {287, 289, 290, 288},
1297 {289, 291, 292, 290},
1298 {291, 293, 294, 292},
1299 {293, 295, 296, 294},
1300 {295, 297, 298, 296},
1301 {297, 299, 300, 298},
1302 {299, 301, 302, 300},
1303 {301, 303, 304, 302},
1304 {303, 305, 306, 304},
1305 {305, 307, 308, 306},
1306 {307, 309, 310, 308},
1307 {309, 311, 312, 310},
1308 {311, 313, 314, 312},
1309 {313, 315, 316, 314},
1310 {315, 317, 318, 316},
1311 {317, 319, 320, 318},
1312 {319, 321, 322, 320},
1313 {321, 323, 324, 322},
1314 {323, 325, 326, 324},
1315 {325, 327, 328, 326},
1316 {327, 329, 330, 328},
1317 {329, 331, 332, 330},
1318 {331, 333, 334, 332},
1319 {333, 335, 336, 334},
1320 {335, 337, 338, 336},
1321 {337, 94, 93, 338} };
1323 for(
int i=0; i < numElem; i++){
1324 for(
int j=0; j < numElementNodes; j++){
1325 if(fabs(ConnCheck[i][j] - Conn[i*numElementNodes+j]) > 1.0e-6){
1326 connCorrect =
false;
1327 std::cout <<
"Incorrect connectivity value at element " << i
1328 <<
" index " << j <<
" Expected " << ConnCheck[i][j]
1329 <<
" Got " << Conn[i*numElementNodes+j] << std::endl;
1333 result.UpdateResult(
"ConnectivityData:Correct", connCorrect);
1337 IntDir = IRAD::Sys::ChDir(OrgDir);
1338 COM_free_buffer(&paneList);
1339 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI,
"OFModule");
1373 virtual void RunTest(
const std::string &name,ResultsType &result)
1376 if(name ==
"ModuleLoadUnload")
1378 else if(name ==
"LoadUnitTestData")
1380 else if(name ==
"ModuleFunctionInitialize")
1382 else if(name ==
"ModuleMeshRegistration")
1384 else if(name ==
"ModuleSurfaceData")
1386 else if(name ==
"ModuleFunctionStepFluid")
1397 virtual void ProcessTests(std::list<std::string> &test_names,ResultsType &result){
1399 std::list<std::string>::iterator tni = test_names.begin();
1400 while(tni != test_names.end())
1412 #ifdef _OPENFOAMMODULEDRIVER_PARALLEL_
1413 template<
typename CommType,
typename ResultsType>
1424 class ParallelTestingObject : TestingObject<ResultsType>
1440 std::string SourceDirPath;
1445 ParallelTestingObject(
CommType &incomm) :
1446 TestingObject<ResultsType>(), _communicator(incomm) {};
1447 CommType &GetCommunicator() {
return(_communicator); };
1452 void SetSourceDirPath(std::string input){
1453 SourceDirPath = input;
1459 virtual void Epilogue() {};
1468 virtual void Prologue(){
1469 for(
int i = _communicator.Size();i <= 1000000;i*=2) N.push_back(i);
1477 virtual int GetInputData(std::string sourceDir, std::string destDir){
1483 OrgDir = IRAD::Sys::CWD();
1486 if(!IRAD::Sys::FILEEXISTS(sourceDir)){
1487 std::cout <<
"GetInputData Error: Could not find data directory, "
1488 << sourceDir <<
". Exiting (fail)." << std::endl;
1494 std::string InFileName;
1495 std::string OutFileName;
1500 if(!IRAD::Sys::FILEEXISTS(destDir)){
1501 IntDir = IRAD::Sys::CreateDirectory(destDir);
1503 std::cout <<
"GetInputData Error: Could not make directory, "
1504 << destDir <<
". Exiting (fail)." << std::endl;
1510 IRAD::Sys::Directory SourceDir(sourceDir);
1513 IntDir = IRAD::Sys::ChDir(destDir);
1515 std::cout <<
"GetInputData Error: Could not change directories to "
1516 << destDir <<
". Exiting (fail)." << std::endl;
1521 for(std::vector<std::string>::iterator it = SourceDir.begin();
1522 it != SourceDir.end(); ++it){
1523 InFileName = sourceDir +
"/" + *it;
1524 OutFileName = IRAD::Sys::CWD() +
"/" + *it;
1526 if(IRAD::Sys::ISLINK(InFileName))
1528 int IntDir = IRAD::Sys::SymLink(InFileName, OutFileName);
1529 else if(IRAD::Sys::ISDIR(InFileName)) {
1531 int IntDir = GetInputData(InFileName, OutFileName);
1534 Inf.open(InFileName.c_str());
1535 Ouf.open(OutFileName.c_str());
1544 IntDir = IRAD::Sys::ChDir(OrgDir);
1546 std::cout <<
"GetInputData Error: Could not change directories to "
1547 << OrgDir <<
". Exiting (fail)." << std::endl;
1561 virtual void Test__ParModuleLoadUnload(ResultsType &result){
1562 std::cout <<
"Running Test__ParModuleLoadUnload" << std::endl;
1565 COM_set_default_communicator((GetCommunicator()).GetCommunicator());
1568 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1572 int h=COM_get_window_handle(
"OFModule");
1574 std::cout <<
" After loading, COM_get_window_handle(\"OFModule\") returns "
1576 std::cout <<
"ParModuleLoadUnload Error: Could not get window handle."
1582 result.UpdateResult(
"LoadParSolverModule:Works",works);
1587 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1591 h=COM_get_window_handle(
"OFModule");
1593 std::cout <<
"After unloading, COM_get_window_handle(\"OFModule\") returns "
1595 std::cout <<
"ParModuleLoadUnload Error: Did not properly unload module."
1601 result.UpdateResult(
"UnloadParSolverModule:Works",works);
1615 virtual void Test__ParCommunicatorPassToModule(ResultsType &result) {
1616 std::cout <<
"Running Test__ParCommunicatorPassToModule" << std::endl;
1617 bool commPass =
false;
1619 COM_set_default_communicator((GetCommunicator()).GetCommunicator());
1621 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1625 MPI_Comm_size((GetCommunicator()).GetCommunicator(), &nProc);
1626 COM_get_array(
"OFModule.nproc", 0, &nProcReg);
1627 if (*nProcReg == nProc)
1630 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1632 result.UpdateResult(
"CommunicatorPassToModule:Pass",commPass);
1642 virtual void Test__ParLoadUnitTestData(ResultsType &result){
1643 std::cout <<
"Running Test__ParLoadUnitTestData" << std::endl;
1646 std::string suffix =
"/share/Testing/test_data/HronTurekFsiPar";
1647 std::string dirName = SourceDirPath + suffix;
1650 std::string TestDir = IRAD::Sys::CWD() +
"/UnitTestDataPar";
1652 if ((GetCommunicator()).Rank() == 0)
1653 IntDir = GetInputData(dirName, TestDir);
1656 (GetCommunicator()).Barrier();
1660 std::cout <<
"ParLoadUnitTestData Error: GetInputData call failed."
1662 result.UpdateResult(
"ParLoadUnitTestData:Works",
false);
1667 if(!IRAD::Sys::FILEEXISTS(TestDir)){
1668 std::cout <<
"ParLoadUnitTestData Error: Could not find directory, "
1669 << TestDir <<
", for running tests." << std::endl;
1670 result.UpdateResult(
"ParLoadUnitTestData:Works",
false);
1675 std::string OrgDir = IRAD::Sys::CWD();
1678 IntDir = IRAD::Sys::ChDir(TestDir);
1680 std::cout <<
"ParLoadUnitTestData Error: Could not change directories to "
1681 << TestDir <<
"." << std::endl;
1682 result.UpdateResult(
"ParLoadUnitTestData:Works",
false);
1685 result.UpdateResult(
"ParLoadUnitTestData:Works",
true);
1687 IntDir = IRAD::Sys::ChDir(OrgDir);
1697 virtual void Test__ParModuleFunctionInitialize(ResultsType &result){
1698 std::cout <<
"Running Test__ParModuleFunctionInitialize" << std::endl;
1699 int myRank = (GetCommunicator()).Rank();
1702 std::cout <<
"Before loading OFModule" << std::endl;
1703 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1704 std::cout <<
"After loading parallel OFModule" << std::endl;
1708 int initHandle = COM_get_function_handle(
"OFModule.InitFoam");
1712 std::cout <<
"ModuleFunctionInitialize Error: Could not get function handle."
1715 result.UpdateResult(
"ParInitFunction:Exists",works);
1720 std::string suffix =
"/share/Testing/test_data/HronTurekFsiPar";
1721 std::string dirName = SourceDirPath + suffix;
1722 std::string testDir = IRAD::Sys::CWD() +
"/UnitTestDataHTFsiPar";
1725 std::cout <<
"Started copying data..." << std::endl;
1726 IntDir = GetInputData(dirName, testDir);
1727 std::cout <<
"Finished copying data..." << std::endl;
1730 (GetCommunicator()).Barrier();
1731 std::string fluidDir = testDir +
"/fluid";
1732 std::string OrgDir = IRAD::Sys::CWD();
1733 IntDir = IRAD::Sys::ChDir(fluidDir);
1742 dummy2[0] =
const_cast<char *
>(
"functionInit");
1743 dummy2[1] =
const_cast<char *
>(
"-parallel");
1744 COM_call_function(initHandle, &dummy1, &dummy2, &verb);
1747 int* initStatus=NULL;
1748 int status = COM_get_status(
"OFModule.initStatus",200+myRank);
1750 std::cout <<
"ModuleFunctionInitialize Error: initStatus not a valid DataItem."
1751 <<
"status = " << status << std::endl;
1755 COM_get_array(
"OFModule.initStatus", 200 + myRank, &initStatus);
1758 if(*initStatus == 0)
1761 std::cout <<
"ModuleFunctionInitialize Error: initStatus not set to zero by InitFoam."
1765 result.UpdateResult(
"ParInitFunction:Runs",works);
1768 IntDir = IRAD::Sys::ChDir(OrgDir);
1769 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1782 virtual void Test__ParModuleSurfaceData(ResultsType &result){
1783 std::cout <<
"Running Test__ParModuleSurfaceData" << std::endl;
1786 int myRank = GetCommunicator().Rank();
1789 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1792 std::string suffix =
"/share/Testing/test_data/HronTurekFsiPar";
1793 std::string dirName = SourceDirPath + suffix;
1794 std::string testDir = IRAD::Sys::CWD() +
"/UnitTestDataParSurfaceData";
1797 IntDir = GetInputData(dirName, testDir);
1798 (GetCommunicator()).Barrier();
1799 std::string fluidDir = testDir +
"/fluid";
1800 std::string OrgDir = IRAD::Sys::CWD();
1801 IntDir = IRAD::Sys::ChDir(fluidDir);
1806 dummy2[0] =
const_cast<char *
>(
"DataReg");
1807 dummy2[1] =
const_cast<char *
>(
"-parallel");
1809 int initHandle = COM_get_function_handle(
"OFModule.InitFoam");
1810 COM_call_function(initHandle, &dummy1, &dummy2, &verb);
1811 std::cout <<
"Rank #"<< myRank <<
", Initialization is finished. "<<std::endl;
1812 _communicator.Barrier();
1817 COM_get_panes(
"OFModule", &numPanes, &paneList);
1820 int pane = paneList[0];
1821 std::cout <<
"Rank "<< myRank <<
" numPanes = " << numPanes << std::endl;
1822 std::cout <<
"Rank "<< myRank <<
" pane ID = " << pane << std::endl;
1825 int status = COM_get_status(
"OFModule.pressure", pane);
1827 std::cout <<
"ParModuleSurfaceData Error: pressure not a valid DataItem. "
1828 <<
"status = " << status << std::endl;
1829 result.UpdateResult(
"ParPressureData:Registered",
false);
1832 result.UpdateResult(
"ParPressureData:Registered",
true);
1836 char getDataItemLoc;
1837 COM_Type getDataItemType;
1838 int getDataItemComponents;
1839 std::string getDataItemUnits;
1840 COM_get_dataitem(
"OFModule.pressure", &getDataItemLoc, &getDataItemType,
1841 &getDataItemComponents, &getDataItemUnits);
1843 double* pressure=NULL;
1844 COM_get_array(
"OFModule.pressure", pane, &pressure);
1850 bool pressureCorrect =
false;
1852 std::vector<int> numPresExpected;
1853 numPresExpected.push_back(154);
1854 numPresExpected.push_back(14);
1855 int numPresCompExpected = 1;
1857 COM_get_size(
"OFModule.pressure", pane, &numPres);
1858 std::cout<<
"Rank #"<<myRank<<
", numPres = "<<numPres<<std::endl;
1859 if (numPres != numPresExpected[myRank] || numPresCompExpected != getDataItemComponents) {
1860 std::cout <<
"Wrong number of pressures registered for this mesh." << std::endl;
1861 std::cout <<
"Got " << numPres <<
" Items, Expected: " << numPresExpected[myRank] << std::endl;
1862 std::cout <<
"Got " << getDataItemComponents <<
" Components, Expected: "
1863 << numPresCompExpected << std::endl;
1865 pressureCorrect =
true;
1870 status = COM_get_status(
"OFModule.traction", pane);
1872 std::cout <<
"ParModuleSurfaceData Error: traction not a valid DataItem."
1873 <<
"status = " << status << std::endl;
1874 result.UpdateResult(
"ParTractionData:Registered",
false);
1877 result.UpdateResult(
"ParTractionData:Registered",
true);
1880 COM_get_dataitem(
"OFModule.traction", &getDataItemLoc, &getDataItemType,
1881 &getDataItemComponents, &getDataItemUnits);
1883 double* traction=NULL;
1884 COM_get_array(
"OFModule.traction", pane, &traction);
1889 bool tractionCorrect =
false;
1891 std::vector<int> numTracExpected;
1892 numTracExpected.push_back(154);
1893 numTracExpected.push_back(14);
1894 int numTracCompExpected = 3;
1895 COM_get_size(
"OFModule.traction", pane, &numTrac);
1897 std::cout<<
"Rank #"<<myRank<<
", numTrac = "<<numTrac<<std::endl;
1898 if (numTrac != numTracExpected[myRank] || numTracCompExpected != getDataItemComponents) {
1899 std::cout <<
"Wrong number of tractions registered for this mesh." << std::endl;
1900 std::cout <<
"Got " << numTrac <<
" Items, Expected: " << numTracExpected[myRank] << std::endl;
1901 std::cout <<
"Got " << getDataItemComponents <<
" Components, Expected: "
1902 << numTracCompExpected << std::endl;
1904 tractionCorrect =
true;
1907 result.UpdateResult(
"ParPressureData:Correct", pressureCorrect);
1908 result.UpdateResult(
"ParTractionData:Correct", tractionCorrect);
1911 IntDir = IRAD::Sys::ChDir(OrgDir);
1913 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1923 virtual void Test__ParModuleMeshRegistration(ResultsType &result){
1924 std::cout <<
"Running Test__ParModuleMeshRegistration" << std::endl;
1925 int myRank = (GetCommunicator()).Rank();
1928 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
1931 int initHandle = COM_get_function_handle(
"OFModule.InitFoam");
1934 std::string suffix =
"/share/Testing/test_data/HronTurekFsiPar";
1935 std::string dirName = SourceDirPath + suffix;
1936 std::string testDir = IRAD::Sys::CWD() +
"/UnitTestDataParMeshTest";
1939 IntDir = GetInputData(dirName, testDir);
1940 (GetCommunicator()).Barrier();
1941 std::string fluidDir = testDir +
"/fluid";
1942 std::string OrgDir = IRAD::Sys::CWD();
1943 IntDir = IRAD::Sys::ChDir(fluidDir);
1948 dummy2[0] =
const_cast<char *
>(
"meshReg");
1949 dummy2[1] =
const_cast<char *
>(
"-parallel");
1951 COM_call_function(initHandle, &dummy1, &dummy2, &verb);
1956 COM_get_dataitems(
"OFModule", &numDataItems, output);
1957 std::istringstream Istr(output);
1958 std::vector<std::string> dataItemNames;
1960 for (
int i=0; i<numDataItems; ++i) {
1963 dataItemNames.push_back(name);
1964 std::cout <<
"Rank #"
1965 << myRank <<
", DataItem # " << i <<
": " << name << std::endl;
1971 COM_get_panes(
"OFModule", &numPanes, &paneList);
1972 std::cout <<
"Rank #"<< myRank <<
", Number of Panes " << numPanes << std::endl;
1973 for (
int i=0; i<numPanes; ++i)
1974 std::cout <<
"Pane ID # " << i+1 <<
"=" << paneList[i] << std::endl;
1977 int pane = paneList[0];
1982 bool coordCorrect =
false;
1984 COM_get_array(
"OFModule.nc", pane, &Coord);
1985 if (Coord == NULL) {
1986 std::cout <<
"In Test__ParModuleMeshRegistration: No mesh coordinates registered."
1990 result.UpdateResult(
"ParCoordinateData:Registered",
true);
1995 std::vector<int> numNodesExpected;
1996 numNodesExpected.push_back(312);
1997 numNodesExpected.push_back(30);
1998 COM_get_size(
"OFModule.nc", pane, &numNodes);
2000 if (numNodes != numNodesExpected[myRank]) {
2001 std::cout <<
"Wrong number of nodes registered for this mesh." << std::endl;
2002 std::cout <<
"Got " << numNodes <<
" Expected: " << numNodesExpected[myRank] << std::endl;
2004 coordCorrect =
true;
2009 double CoordCheck0[312][3] =
2010 {{0.299528, 0.21, -0.025334},
2011 {0.299528, 0.21, 0.025334},
2012 {0.295179, 0.21, 0.025334},
2013 {0.295179, 0.21, -0.025334},
2014 {0.291124, 0.21, 0.025334},
2015 {0.291124, 0.21, -0.025334},
2016 {0.287343, 0.21, 0.025334},
2017 {0.287343, 0.21, -0.025334},
2018 {0.283818, 0.21, 0.025334},
2019 {0.283818, 0.21, -0.025334},
2020 {0.280531, 0.21, 0.025334},
2021 {0.280531, 0.21, -0.025334},
2022 {0.277466, 0.21, 0.025334},
2023 {0.277466, 0.21, -0.025334},
2024 {0.274609, 0.21, 0.025334},
2025 {0.274609, 0.21, -0.025334},
2026 {0.271945, 0.21, 0.025334},
2027 {0.271945, 0.21, -0.025334},
2028 {0.26946, 0.21, 0.025334},
2029 {0.26946, 0.21, -0.025334},
2030 {0.267144, 0.21, 0.025334},
2031 {0.267144, 0.21, -0.025334},
2032 {0.264984, 0.21, 0.025334},
2033 {0.264984, 0.21, -0.025334},
2034 {0.262971, 0.21, 0.025334},
2035 {0.262971, 0.21, -0.025334},
2036 {0.261093, 0.21, 0.025334},
2037 {0.261093, 0.21, -0.025334},
2038 {0.259343, 0.21, 0.025334},
2039 {0.259343, 0.21, -0.025334},
2040 {0.25771, 0.21, 0.025334},
2041 {0.25771, 0.21, -0.025334},
2042 {0.256188, 0.21, 0.025334},
2043 {0.256188, 0.21, -0.025334},
2044 {0.254769, 0.21, 0.025334},
2045 {0.254769, 0.21, -0.025334},
2046 {0.253446, 0.21, 0.025334},
2047 {0.253446, 0.21, -0.025334},
2048 {0.252213, 0.21, 0.025334},
2049 {0.252213, 0.21, -0.025334},
2050 {0.251062, 0.21, 0.025334},
2051 {0.251062, 0.21, -0.025334},
2052 {0.24999, 0.21, 0.025334},
2053 {0.24999, 0.21, -0.025334},
2054 {0.24899, 0.21, 0.025334},
2055 {0.24899, 0.21, -0.025334},
2056 {0.295179, 0.19, 0.025334},
2057 {0.299528, 0.19, 0.025334},
2058 {0.299528, 0.19, -0.025334},
2059 {0.295179, 0.19, -0.025334},
2060 {0.291124, 0.19, 0.025334},
2061 {0.291124, 0.19, -0.025334},
2062 {0.287343, 0.19, 0.025334},
2063 {0.287343, 0.19, -0.025334},
2064 {0.283818, 0.19, 0.025334},
2065 {0.283818, 0.19, -0.025334},
2066 {0.280531, 0.19, 0.025334},
2067 {0.280531, 0.19, -0.025334},
2068 {0.277466, 0.19, 0.025334},
2069 {0.277466, 0.19, -0.025334},
2070 {0.274609, 0.19, 0.025334},
2071 {0.274609, 0.19, -0.025334},
2072 {0.271945, 0.19, 0.025334},
2073 {0.271945, 0.19, -0.025334},
2074 {0.26946, 0.19, 0.025334},
2075 {0.26946, 0.19, -0.025334},
2076 {0.267144, 0.19, 0.025334},
2077 {0.267144, 0.19, -0.025334},
2078 {0.264984, 0.19, 0.025334},
2079 {0.264984, 0.19, -0.025334},
2080 {0.262971, 0.19, 0.025334},
2081 {0.262971, 0.19, -0.025334},
2082 {0.261093, 0.19, 0.025334},
2083 {0.261093, 0.19, -0.025334},
2084 {0.259343, 0.19, 0.025334},
2085 {0.259343, 0.19, -0.025334},
2086 {0.25771, 0.19, 0.025334},
2087 {0.25771, 0.19, -0.025334},
2088 {0.256188, 0.19, 0.025334},
2089 {0.256188, 0.19, -0.025334},
2090 {0.254769, 0.19, 0.025334},
2091 {0.254769, 0.19, -0.025334},
2092 {0.253446, 0.19, 0.025334},
2093 {0.253446, 0.19, -0.025334},
2094 {0.252213, 0.19, 0.025334},
2095 {0.252213, 0.19, -0.025334},
2096 {0.251062, 0.19, 0.025334},
2097 {0.251062, 0.19, -0.025334},
2098 {0.24999, 0.19, 0.025334},
2099 {0.24999, 0.19, -0.025334},
2100 {0.24899, 0.19, -0.025334},
2101 {0.24899, 0.19, 0.025334},
2102 {0.574961, 0.21, 0.025334},
2103 {0.569953, 0.21, 0.025334},
2104 {0.569953, 0.21, -0.025334},
2105 {0.574961, 0.21, -0.025334},
2106 {0.564945, 0.21, 0.025334},
2107 {0.564945, 0.21, -0.025334},
2108 {0.559937, 0.21, 0.025334},
2109 {0.559937, 0.21, -0.025334},
2110 {0.554929, 0.21, 0.025334},
2111 {0.554929, 0.21, -0.025334},
2112 {0.549921, 0.21, 0.025334},
2113 {0.549921, 0.21, -0.025334},
2114 {0.544913, 0.21, 0.025334},
2115 {0.544913, 0.21, -0.025334},
2116 {0.539906, 0.21, 0.025334},
2117 {0.539906, 0.21, -0.025334},
2118 {0.534898, 0.21, 0.025334},
2119 {0.534898, 0.21, -0.025334},
2120 {0.52989, 0.21, 0.025334},
2121 {0.52989, 0.21, -0.025334},
2122 {0.524882, 0.21, 0.025334},
2123 {0.524882, 0.21, -0.025334},
2124 {0.519874, 0.21, 0.025334},
2125 {0.519874, 0.21, -0.025334},
2126 {0.514866, 0.21, 0.025334},
2127 {0.514866, 0.21, -0.025334},
2128 {0.509858, 0.21, 0.025334},
2129 {0.509858, 0.21, -0.025334},
2130 {0.50485, 0.21, 0.025334},
2131 {0.50485, 0.21, -0.025334},
2132 {0.499843, 0.21, 0.025334},
2133 {0.499843, 0.21, -0.025334},
2134 {0.494835, 0.21, 0.025334},
2135 {0.494835, 0.21, -0.025334},
2136 {0.489827, 0.21, 0.025334},
2137 {0.489827, 0.21, -0.025334},
2138 {0.484819, 0.21, 0.025334},
2139 {0.484819, 0.21, -0.025334},
2140 {0.479811, 0.21, 0.025334},
2141 {0.479811, 0.21, -0.025334},
2142 {0.474803, 0.21, 0.025334},
2143 {0.474803, 0.21, -0.025334},
2144 {0.469795, 0.21, 0.025334},
2145 {0.469795, 0.21, -0.025334},
2146 {0.464787, 0.21, 0.025334},
2147 {0.464787, 0.21, -0.025334},
2148 {0.45978, 0.21, 0.025334},
2149 {0.45978, 0.21, -0.025334},
2150 {0.454772, 0.21, 0.025334},
2151 {0.454772, 0.21, -0.025334},
2152 {0.449764, 0.21, 0.025334},
2153 {0.449764, 0.21, -0.025334},
2154 {0.444756, 0.21, 0.025334},
2155 {0.444756, 0.21, -0.025334},
2156 {0.439748, 0.21, 0.025334},
2157 {0.439748, 0.21, -0.025334},
2158 {0.43474, 0.21, 0.025334},
2159 {0.43474, 0.21, -0.025334},
2160 {0.429732, 0.21, 0.025334},
2161 {0.429732, 0.21, -0.025334},
2162 {0.424724, 0.21, 0.025334},
2163 {0.424724, 0.21, -0.025334},
2164 {0.419717, 0.21, 0.025334},
2165 {0.419717, 0.21, -0.025334},
2166 {0.414709, 0.21, 0.025334},
2167 {0.414709, 0.21, -0.025334},
2168 {0.409701, 0.21, 0.025334},
2169 {0.409701, 0.21, -0.025334},
2170 {0.404693, 0.21, 0.025334},
2171 {0.404693, 0.21, -0.025334},
2172 {0.399685, 0.21, 0.025334},
2173 {0.399685, 0.21, -0.025334},
2174 {0.394677, 0.21, 0.025334},
2175 {0.394677, 0.21, -0.025334},
2176 {0.389669, 0.21, 0.025334},
2177 {0.389669, 0.21, -0.025334},
2178 {0.384661, 0.21, 0.025334},
2179 {0.384661, 0.21, -0.025334},
2180 {0.379654, 0.21, 0.025334},
2181 {0.379654, 0.21, -0.025334},
2182 {0.374646, 0.21, 0.025334},
2183 {0.374646, 0.21, -0.025334},
2184 {0.369638, 0.21, 0.025334},
2185 {0.369638, 0.21, -0.025334},
2186 {0.36463, 0.21, 0.025334},
2187 {0.36463, 0.21, -0.025334},
2188 {0.359622, 0.21, 0.025334},
2189 {0.359622, 0.21, -0.025334},
2190 {0.354614, 0.21, 0.025334},
2191 {0.354614, 0.21, -0.025334},
2192 {0.349606, 0.21, 0.025334},
2193 {0.349606, 0.21, -0.025334},
2194 {0.344599, 0.21, 0.025334},
2195 {0.344599, 0.21, -0.025334},
2196 {0.339591, 0.21, 0.025334},
2197 {0.339591, 0.21, -0.025334},
2198 {0.334583, 0.21, 0.025334},
2199 {0.334583, 0.21, -0.025334},
2200 {0.329575, 0.21, 0.025334},
2201 {0.329575, 0.21, -0.025334},
2202 {0.324567, 0.21, 0.025334},
2203 {0.324567, 0.21, -0.025334},
2204 {0.319559, 0.21, 0.025334},
2205 {0.319559, 0.21, -0.025334},
2206 {0.314551, 0.21, 0.025334},
2207 {0.314551, 0.21, -0.025334},
2208 {0.309543, 0.21, 0.025334},
2209 {0.309543, 0.21, -0.025334},
2210 {0.304536, 0.21, 0.025334},
2211 {0.304536, 0.21, -0.025334},
2212 {0.304536, 0.19, 0.025334},
2213 {0.304536, 0.19, -0.025334},
2214 {0.309543, 0.19, 0.025334},
2215 {0.309543, 0.19, -0.025334},
2216 {0.314551, 0.19, 0.025334},
2217 {0.314551, 0.19, -0.025334},
2218 {0.319559, 0.19, 0.025334},
2219 {0.319559, 0.19, -0.025334},
2220 {0.324567, 0.19, 0.025334},
2221 {0.324567, 0.19, -0.025334},
2222 {0.329575, 0.19, 0.025334},
2223 {0.329575, 0.19, -0.025334},
2224 {0.334583, 0.19, 0.025334},
2225 {0.334583, 0.19, -0.025334},
2226 {0.339591, 0.19, 0.025334},
2227 {0.339591, 0.19, -0.025334},
2228 {0.344599, 0.19, 0.025334},
2229 {0.344599, 0.19, -0.025334},
2230 {0.349606, 0.19, 0.025334},
2231 {0.349606, 0.19, -0.025334},
2232 {0.354614, 0.19, 0.025334},
2233 {0.354614, 0.19, -0.025334},
2234 {0.359622, 0.19, 0.025334},
2235 {0.359622, 0.19, -0.025334},
2236 {0.36463, 0.19, 0.025334},
2237 {0.36463, 0.19, -0.025334},
2238 {0.369638, 0.19, 0.025334},
2239 {0.369638, 0.19, -0.025334},
2240 {0.374646, 0.19, 0.025334},
2241 {0.374646, 0.19, -0.025334},
2242 {0.379654, 0.19, 0.025334},
2243 {0.379654, 0.19, -0.025334},
2244 {0.384661, 0.19, 0.025334},
2245 {0.384661, 0.19, -0.025334},
2246 {0.389669, 0.19, 0.025334},
2247 {0.389669, 0.19, -0.025334},
2248 {0.394677, 0.19, 0.025334},
2249 {0.394677, 0.19, -0.025334},
2250 {0.399685, 0.19, 0.025334},
2251 {0.399685, 0.19, -0.025334},
2252 {0.404693, 0.19, 0.025334},
2253 {0.404693, 0.19, -0.025334},
2254 {0.409701, 0.19, 0.025334},
2255 {0.409701, 0.19, -0.025334},
2256 {0.414709, 0.19, 0.025334},
2257 {0.414709, 0.19, -0.025334},
2258 {0.419717, 0.19, 0.025334},
2259 {0.419717, 0.19, -0.025334},
2260 {0.424724, 0.19, 0.025334},
2261 {0.424724, 0.19, -0.025334},
2262 {0.429732, 0.19, 0.025334},
2263 {0.429732, 0.19, -0.025334},
2264 {0.43474, 0.19, 0.025334},
2265 {0.43474, 0.19, -0.025334},
2266 {0.439748, 0.19, 0.025334},
2267 {0.439748, 0.19, -0.025334},
2268 {0.444756, 0.19, 0.025334},
2269 {0.444756, 0.19, -0.025334},
2270 {0.449764, 0.19, 0.025334},
2271 {0.449764, 0.19, -0.025334},
2272 {0.454772, 0.19, 0.025334},
2273 {0.454772, 0.19, -0.025334},
2274 {0.45978, 0.19, 0.025334},
2275 {0.45978, 0.19, -0.025334},
2276 {0.464787, 0.19, 0.025334},
2277 {0.464787, 0.19, -0.025334},
2278 {0.469795, 0.19, 0.025334},
2279 {0.469795, 0.19, -0.025334},
2280 {0.474803, 0.19, 0.025334},
2281 {0.474803, 0.19, -0.025334},
2282 {0.479811, 0.19, 0.025334},
2283 {0.479811, 0.19, -0.025334},
2284 {0.484819, 0.19, 0.025334},
2285 {0.484819, 0.19, -0.025334},
2286 {0.489827, 0.19, 0.025334},
2287 {0.489827, 0.19, -0.025334},
2288 {0.494835, 0.19, 0.025334},
2289 {0.494835, 0.19, -0.025334},
2290 {0.499843, 0.19, 0.025334},
2291 {0.499843, 0.19, -0.025334},
2292 {0.50485, 0.19, 0.025334},
2293 {0.50485, 0.19, -0.025334},
2294 {0.509858, 0.19, 0.025334},
2295 {0.509858, 0.19, -0.025334},
2296 {0.514866, 0.19, 0.025334},
2297 {0.514866, 0.19, -0.025334},
2298 {0.519874, 0.19, 0.025334},
2299 {0.519874, 0.19, -0.025334},
2300 {0.524882, 0.19, 0.025334},
2301 {0.524882, 0.19, -0.025334},
2302 {0.52989, 0.19, 0.025334},
2303 {0.52989, 0.19, -0.025334},
2304 {0.534898, 0.19, 0.025334},
2305 {0.534898, 0.19, -0.025334},
2306 {0.539906, 0.19, 0.025334},
2307 {0.539906, 0.19, -0.025334},
2308 {0.544913, 0.19, 0.025334},
2309 {0.544913, 0.19, -0.025334},
2310 {0.549921, 0.19, 0.025334},
2311 {0.549921, 0.19, -0.025334},
2312 {0.554929, 0.19, 0.025334},
2313 {0.554929, 0.19, -0.025334},
2314 {0.559937, 0.19, 0.025334},
2315 {0.559937, 0.19, -0.025334},
2316 {0.564945, 0.19, 0.025334},
2317 {0.564945, 0.19, -0.025334},
2318 {0.569953, 0.19, 0.025334},
2319 {0.569953, 0.19, -0.025334},
2320 {0.574961, 0.19, 0.025334},
2321 {0.574961, 0.19, -0.025334}};
2324 double CoordCheck1[30][3] =
2325 { { 0.6, 0.19, -0.025334},
2326 {0.6, 0.19, 0.025334},
2327 {0.6, 0.195, 0.025334},
2328 {0.6, 0.195, -0.025334},
2329 {0.6, 0.2, 0.025334},
2330 {0.6, 0.2, -0.025334},
2331 {0.6, 0.205, 0.025334},
2332 {0.6, 0.205, -0.025334},
2333 {0.6, 0.21, 0.025334},
2334 {0.6, 0.21, -0.025334},
2335 {0.594992, 0.21, 0.025334},
2336 {0.594992, 0.21, -0.025334},
2337 {0.589984, 0.21, 0.025334},
2338 {0.589984, 0.21, -0.025334},
2339 {0.584976, 0.21, 0.025334},
2340 {0.584976, 0.21, -0.025334},
2341 {0.579969, 0.21, 0.025334},
2342 {0.579969, 0.21, -0.025334},
2343 {0.574961, 0.21, 0.025334},
2344 {0.574961, 0.21, -0.025334},
2345 {0.574961, 0.19, 0.025334},
2346 {0.579969, 0.19, 0.025334},
2347 {0.579969, 0.19, -0.025334},
2348 {0.574961, 0.19, -0.025334},
2349 {0.584976, 0.19, 0.025334},
2350 {0.584976, 0.19, -0.025334},
2351 {0.589984, 0.19, 0.025334},
2352 {0.589984, 0.19, -0.025334},
2353 {0.594992, 0.19, 0.025334},
2354 {0.594992, 0.19, -0.025334} };
2357 for(
int i=0; i < numNodes; i++) {
2359 for(
int j=0; j < 3; j++){
2364 if(fabs(CoordCheck0[i][j] - Coord[i*3+j]) > 1.0e-6){
2365 coordCorrect =
false;
2366 std::cout <<
"Incorrect coordinate value for node=" << i
2367 <<
" index " << j <<
" Expected " << CoordCheck0[i][j]
2368 <<
" Got " << Coord[i*3+j] << std::endl;
2371 if(fabs(CoordCheck1[i][j] - Coord[i*3+j]) > 1.0e-6){
2372 coordCorrect =
false;
2373 std::cout <<
"Incorrect coordinate value for node=" << i
2374 <<
" index " << j <<
" Expected " << CoordCheck1[i][j]
2375 <<
" Got " << Coord[i*3+j] << std::endl;
2381 result.UpdateResult(
"ParCoordinateData:Correct", coordCorrect);
2386 bool connCorrect =
true;
2390 std::string stringNames;
2391 COM_get_connectivities(
"OFModule", pane, &numConn, stringNames);
2392 std::istringstream ConnISS(stringNames);
2393 std::vector<std::string> connNames;
2395 for (
int i=0; i<numConn; ++i) {
2398 connNames.push_back(name);
2399 std::cout <<
"Connectivity Table # " << i+1 <<
": " << name << std::endl;
2403 char getDataItemLoc;
2404 COM_Type getDataItemType;
2405 int numElementNodes;
2406 std::string getDataItemUnits;
2407 std::string fullConnName(
"OFModule."+connNames[0]);
2408 COM_get_dataitem(fullConnName, &getDataItemLoc, &getDataItemType,
2409 &numElementNodes, &getDataItemUnits);
2411 std::cout <<
"getDataItemLoc " << getDataItemLoc << std::endl;
2412 std::cout <<
"getDataItemType " << getDataItemType << std::endl;
2413 std::cout <<
"numElementNodes " << numElementNodes << std::endl;
2414 std::cout <<
"getDataItemUnits " << getDataItemUnits << std::endl;
2417 COM_get_array(fullConnName.c_str(), pane, &Conn);
2420 std::cout <<
"In Test__ParModuleMeshRegistration: No mesh connectivity registered."
2424 result.UpdateResult(
"ParConnectivityData:Registered",
true);
2429 std::vector<int> numElemExpected;
2430 numElemExpected.push_back(154);
2431 numElemExpected.push_back(14);
2432 COM_get_size(fullConnName, pane, &numElem);
2434 if (numElem != numElemExpected[myRank]) {
2435 std::cout <<
"Wrong number of elements registered for this mesh." << std::endl;
2436 std::cout <<
"Got " << numElem <<
" Expected: " << numElemExpected[myRank] << std::endl;
2441 int ConnCheck0[154][4] =
2489 {99, 101, 102, 100},
2490 {101, 103, 104, 102},
2491 {103, 105, 106, 104},
2492 {105, 107, 108, 106},
2493 {107, 109, 110, 108},
2494 {109, 111, 112, 110},
2495 {111, 113, 114, 112},
2496 {113, 115, 116, 114},
2497 {115, 117, 118, 116},
2498 {117, 119, 120, 118},
2499 {119, 121, 122, 120},
2500 {121, 123, 124, 122},
2501 {123, 125, 126, 124},
2502 {125, 127, 128, 126},
2503 {127, 129, 130, 128},
2504 {129, 131, 132, 130},
2505 {131, 133, 134, 132},
2506 {133, 135, 136, 134},
2507 {135, 137, 138, 136},
2508 {137, 139, 140, 138},
2509 {139, 141, 142, 140},
2510 {141, 143, 144, 142},
2511 {143, 145, 146, 144},
2512 {145, 147, 148, 146},
2513 {147, 149, 150, 148},
2514 {149, 151, 152, 150},
2515 {151, 153, 154, 152},
2516 {153, 155, 156, 154},
2517 {155, 157, 158, 156},
2518 {157, 159, 160, 158},
2519 {159, 161, 162, 160},
2520 {161, 163, 164, 162},
2521 {163, 165, 166, 164},
2522 {165, 167, 168, 166},
2523 {167, 169, 170, 168},
2524 {169, 171, 172, 170},
2525 {171, 173, 174, 172},
2526 {173, 175, 176, 174},
2527 {175, 177, 178, 176},
2528 {177, 179, 180, 178},
2529 {179, 181, 182, 180},
2530 {181, 183, 184, 182},
2531 {183, 185, 186, 184},
2532 {185, 187, 188, 186},
2533 {187, 189, 190, 188},
2534 {189, 191, 192, 190},
2535 {191, 193, 194, 192},
2536 {193, 195, 196, 194},
2537 {195, 197, 198, 196},
2538 {197, 199, 200, 198},
2539 {199, 201, 202, 200},
2542 {203, 205, 206, 204},
2543 {205, 207, 208, 206},
2544 {207, 209, 210, 208},
2545 {209, 211, 212, 210},
2546 {211, 213, 214, 212},
2547 {213, 215, 216, 214},
2548 {215, 217, 218, 216},
2549 {217, 219, 220, 218},
2550 {219, 221, 222, 220},
2551 {221, 223, 224, 222},
2552 {223, 225, 226, 224},
2553 {225, 227, 228, 226},
2554 {227, 229, 230, 228},
2555 {229, 231, 232, 230},
2556 {231, 233, 234, 232},
2557 {233, 235, 236, 234},
2558 {235, 237, 238, 236},
2559 {237, 239, 240, 238},
2560 {239, 241, 242, 240},
2561 {241, 243, 244, 242},
2562 {243, 245, 246, 244},
2563 {245, 247, 248, 246},
2564 {247, 249, 250, 248},
2565 {249, 251, 252, 250},
2566 {251, 253, 254, 252},
2567 {253, 255, 256, 254},
2568 {255, 257, 258, 256},
2569 {257, 259, 260, 258},
2570 {259, 261, 262, 260},
2571 {261, 263, 264, 262},
2572 {263, 265, 266, 264},
2573 {265, 267, 268, 266},
2574 {267, 269, 270, 268},
2575 {269, 271, 272, 270},
2576 {271, 273, 274, 272},
2577 {273, 275, 276, 274},
2578 {275, 277, 278, 276},
2579 {277, 279, 280, 278},
2580 {279, 281, 282, 280},
2581 {281, 283, 284, 282},
2582 {283, 285, 286, 284},
2583 {285, 287, 288, 286},
2584 {287, 289, 290, 288},
2585 {289, 291, 292, 290},
2586 {291, 293, 294, 292},
2587 {293, 295, 296, 294},
2588 {295, 297, 298, 296},
2589 {297, 299, 300, 298},
2590 {299, 301, 302, 300},
2591 {301, 303, 304, 302},
2592 {303, 305, 306, 304},
2593 {305, 307, 308, 306},
2594 {307, 309, 310, 308},
2595 {309, 311, 312, 310} };
2597 int ConnCheck1[14][4] =
2614 for(
int i=0; i < numElem; i++){
2616 for(
int j=0; j < numElementNodes; j++){
2621 if(fabs(ConnCheck0[i][j] - Conn[i*numElementNodes+j]) > 1.0e-6){
2622 connCorrect =
false;
2623 std::cout <<
"Incorrect connectivity value at element " << i
2624 <<
" index " << j <<
" Expected " << ConnCheck0[i][j]
2625 <<
" Got " << Conn[i*numElementNodes+j] << std::endl;
2628 if(fabs(ConnCheck1[i][j] - Conn[i*numElementNodes+j]) > 1.0e-6){
2629 connCorrect =
false;
2630 std::cout <<
"Incorrect connectivity value at element " << i
2631 <<
" index " << j <<
" Expected " << ConnCheck1[i][j]
2632 <<
" Got " << Conn[i*numElementNodes+j] << std::endl;
2638 result.UpdateResult(
"ParConnectivityData:Correct", connCorrect);
2642 IntDir = IRAD::Sys::ChDir(OrgDir);
2643 COM_free_buffer(&paneList);
2644 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
2658 virtual void Test__ParModuleFunctionStepFluid(ResultsType &result){
2659 std::cout <<
"Running Test__ParModuleFunctionStepFluid" << std::endl;
2660 int myRank = (GetCommunicator()).Rank();
2663 COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
2668 std::string suffix =
"/share/Testing/test_data/HronTurekFsiPar";
2669 std::string dirName = SourceDirPath + suffix;
2670 std::string testDir = IRAD::Sys::CWD() +
"/UnitTestDataParStepTest";
2674 GetInputData(dirName, testDir);
2676 (GetCommunicator()).Barrier();
2677 std::string fluidDir = testDir +
"/fluid";
2678 std::string OrgDir = IRAD::Sys::CWD();
2679 IntDir = IRAD::Sys::ChDir(fluidDir);
2684 dummy2[0] =
const_cast<char *
>(
"StepFluid");
2685 dummy2[1] =
const_cast<char *
>(
"-parallel");
2687 int initHandle = COM_get_function_handle(
"OFModule.InitFoam");
2688 COM_call_function(initHandle, &dummy1, &dummy2, &verb);
2693 COM_get_panes(
"OFModule", &numPanes, &paneList);
2696 int pane = paneList[0];
2699 int status = COM_get_status(
"OFModule.time", pane);
2700 bool timeStatus =
false;
2702 std::cout <<
"ModuleFunctionParStepFluid Error: time not a valid DataItem."
2703 <<
"status = " << status << std::endl;
2704 result.UpdateResult(
"ParTimeData:Registered",
false);
2710 status = COM_get_status(
"OFModule.endTime", pane);
2712 std::cout <<
"ParModuleFunctionStepFluid Error: endTime not a valid DataItem."
2713 <<
"status = " << status << std::endl;
2714 result.UpdateResult(
"ParTimeData:Registered",
false);
2717 timeStatus = timeStatus &&
true;
2719 result.UpdateResult(
"ParTimeData:Registered", timeStatus);
2722 COM_get_array(
"OFModule.time", pane, &time);
2723 double* endTime=NULL;
2724 COM_get_array(
"OFModule.endTime", pane, &endTime);
2727 double testTime = 0.;
2728 double testEndTime = 5.0e-3;
2729 double toler = 1.e-9;
2730 if(std::fabs(*time - testTime) < toler && std::fabs(*endTime - testEndTime) < toler)
2733 std::cout <<
"ParModuleFunctionStepFluid Error: time or endTime initialized incorrectly"
2735 std::cout <<
" time = " << *time <<
" expected " << testTime << std::endl;
2736 std::cout <<
" endTime = " << *endTime <<
" expected " << testEndTime << std::endl;
2738 result.UpdateResult(
"ParTimeData:Correct",works);
2741 std::string newDataItemName =
"OFModule.setsProb";
2742 COM_new_dataitem(newDataItemName.c_str(),
'w',COM_INT,1,
"");
2744 COM_set_array((newDataItemName).c_str(),0,&setsProb);
2748 int stepHandle = COM_get_function_handle(
"OFModule.StepFluid");
2752 std::cout <<
"ParModuleFunctionStepFluid Error: Could not get function handle."
2754 result.UpdateResult(
"ParStepFluidFunction:Exists",
false);
2757 result.UpdateResult(
"ParStepFluidFunction:Exists",works);
2761 COM_call_function(stepHandle);
2767 if (std::fabs(*time - testTime) < toler )
2770 std::cout <<
"ParModuleFunctionStepFluid Error: time did not increment"
2772 std::cout <<
" time = " << *time <<
"expected " << testTime << std::endl;
2774 result.UpdateResult(
"ParStepFluidFunction:Steps",works);
2777 IntDir = IRAD::Sys::ChDir(OrgDir);
2779 COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar,
"OFModule");
2792 virtual void Process(ResultsType &result){
2794 Test__ParModuleLoadUnload(result);
2795 Test__ParCommunicatorPassToModule(result);
2796 Test__ParLoadUnitTestData(result);
2797 Test__ParModuleFunctionInitialize(result);
2798 Test__ParModuleSurfaceData(result);
2799 Test__ParModuleMeshRegistration(result);
2800 Test__ParModuleFunctionStepFluid (result);
2810 virtual void RunTest(
const std::string &name,ResultsType &result)
2812 if(name ==
"ParCommunicatorPassToModule")
2813 Test__ParCommunicatorPassToModule(result);
2814 if(name ==
"ParSolverLoadUnload")
2815 Test__ParModuleLoadUnload(result);
2816 if(name ==
"ParLoadUnitTestData")
2817 Test__ParLoadUnitTestData(result);
2818 if(name ==
"ParModuleInitFuncion")
2819 Test__ParModuleFunctionInitialize(result);
2820 if(name ==
"ParModuleSurfaceData")
2821 Test__ParModuleSurfaceData(result);
2822 if(name ==
"ParModuleMeshRegistration")
2823 Test__ParModuleMeshRegistration(result);
2824 if(name ==
"ParModuleFunctionStepFluid")
2825 Test__ParModuleFunctionStepFluid(result);
2834 virtual void ProcessTests(std::list<std::string> &test_names,ResultsType &result){
2836 std::list<std::string>::iterator tni = test_names.begin();
2837 while(tni != test_names.end())
2838 RunTest(*tni++,result);
void SetSourceDirPath(std::string input)
Sets the string value of the testing source directory.
std::string ExampleTestFixture
A sample string test fixture.
virtual void RunTest(const std::string &name, ResultsType &result)
Runs a test specified by name.
Project-specific testing object.
virtual void Test__ModuleMeshRegistration(ResultsType &result)
TestingObject()
Default constructor.
std::vector< int > N
A set of values for testing quadrature methods.
virtual void Test__ModuleFunctionStepFluid(ResultsType &result)
IRAD::Comm::CommunicatorObject CommType
Convenience typedef for CommunicatorObject.
double F1(double x)
Simple test function fixture returns .
virtual void Test__ModuleLoadUnload(ResultsType &result)
IRAD::Util::TestResults TestResults
Project-specific test results type.
double F1(double x)
Simple test function fixture returns .
virtual int GetInputData(std::string sourceDir, std::string destDir)
Function to copy input data from source testing directory for use in unit tests.
virtual void ProcessTests(std::list< std::string > &test_names, ResultsType &result)
Runs a list of tests specified by name.
virtual void Process(ResultsType &result)
COM_EXTERN_MODULE(OpenFoamFSI)
virtual void Test__ModuleSurfaceData(ResultsType &result)
double F2(double x)
Simple test function fixture returns .
virtual void Test__LoadUnitTestData(ResultsType &result)
virtual void Prologue()
Sets up the data fixtures for the tests.
IRAD::Util::TestingObject< ResultsType > TestingObjectBaseType
double F2(double x)
Simple test function fixture returns .
virtual void Epilogue()
Tears down the testing fixtures if needed.
IRAD::Util::TestResults TestResults
Project-specific test results type.
std::string SourceDirPath
The string for the testing source directory.
virtual void Test__ModuleFunctionInitialize(ResultsType &result)