15 namespace ElmerFoamFSI{
20 typedef IRAD::Comm::CommunicatorObject
CommType;
53 int com_initialized = COM_initialized();
54 bool com_initialized_pass = (com_initialized <= 0);
56 COM_init(&argc, &argv);
57 if(com_initialized_pass)
58 com_initialized = (COM_initialized() > 0);
65 int rank = communicator.Rank();
66 int nproc = communicator.Size();
67 bool do_stdout = !rank;
80 int clerr = comline.ProcessOptions();
82 if(!comline.GetOption(
"help").empty()){
85 std::cout << comline.LongUsage() << std::endl;
87 std::cout <<
"ElmerFoamFSI::ParallelTest: Exiting test function (success)"
90 communicator.SetExit(1);
92 if(communicator.Check())
96 std::cout << comline.ErrorReport() << std::endl
97 << std::endl << comline.ShortUsage() << std::endl;
99 std::cout <<
"ElmerFoamFSI::ParallelTest: Exiting test function (fail)" << std::endl;
101 communicator.SetExit(1);
103 if(communicator.Check())
109 std::ostream *Out = NULL;
115 std::string OutFileName(comline.GetOption(
"output"));
116 std::string TestName(comline.GetOption(
"name"));
117 std::string ListName(comline.GetOption(
"list"));
118 std::string sverb(comline.GetOption(
"verblevel"));
119 std::string SourcePath(comline.GetOption(
"source"));
124 if(sverb !=
".true."){
125 std::istringstream Istr(sverb);
133 if(!OutFileName.empty()){
135 Ouf.open(OutFileName.c_str());
137 std::cout <<
"ElmerFoamFSI::ParallelTest> Error: Could not open output file, "
138 << OutFileName <<
" for test output. Exiting (fail)." << std::endl;
139 communicator.SetExit(1);
143 if(communicator.Check())
147 if(verblevel > 1 && Out)
148 *Out <<
"ElmerFoamFSI::ParallelTest: Entering test function" << std::endl;
151 ElmerFoamFSI::ParallelTestingObject<ElmerFoamFSI::CommType,ElmerFoamFSI::TestResults> test(communicator);
156 if(!SourcePath.empty()){
157 test.SetSourceDirPath(SourcePath);
161 if(!TestName.empty()){
164 std::cout <<
"Processing test : " << TestName << std::endl;
165 test.RunTest(TestName,results);
169 else if(!ListName.empty()){
171 std::cout <<
"Processing list of tests" << std::endl;
172 std::ifstream ListInf;
173 ListInf.open(ListName.c_str());
176 *Out <<
"ElmerFoamFSI::ParallelTest> Error: Could not open list of tests in file "
177 << ListName <<
". Exiting (fail)." << std::endl;
178 communicator.SetExit(1);
180 if(communicator.Check())
182 std::string testname;
183 while(std::getline(ListInf,testname))
184 test.RunTest(testname,results);
190 std::cout <<
"Processing all of the tests" << std::endl;
191 test.Process(results);
194 *Out << results << std::endl;
199 if((verblevel > 1) && Out)
200 *Out <<
"ElmerFoamFSI::ParallelTest: Exiting test function (success)" << std::endl;
206 int main(
int argc,
char *argv[])
ComLineObject for ElmerFoamFSI testing command-line interface.
int ParallelTest(int argc, char *argv[])
Drives the ElmerFoamFSI::TestObject.
IRAD::Comm::CommunicatorObject CommType
Convenience typedef for CommunicatorObject.
Testing utilities for ElmerFoamFSI.
IRAD::Util::TestResults TestResults
Project-specific test results type.