ElmerFoamFSI  2.0
ElmerFoamFSI is fluid-solid interaction simulation application built up from OpenFOAM CFD and Elmer CSM coupled through the IMPACT multiphysics software integration infrastructure.
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Macros Groups Pages
OpenFoamModuleDriverTest.H
Go to the documentation of this file.
1 #ifndef __OPENFOAMMODULEDRIVER_TEST_H__
13 #define __OPENFOAMMODULEDRIVER_TEST_H__
14 #ifdef _OPENFOAMMODULEDRIVER_PARALLEL_
15 #include "COMM.H"
16 #endif
17 #include "Testing.H"
18 #include "Profiler.H"
19 #include <vector>
20 #include <cmath>
21 #include "com.h"
22 #include "com_devel.hpp"
23 #include "UnixUtils.H"
24 
25 COM_EXTERN_MODULE(OpenFoamFSI);
26 COM_EXTERN_MODULE(OpenFoamFSIPar);
27 
28 namespace OpenFoamModuleDriver {
29 
33  namespace TestFixture {
39  double F1(double x) { return (2.0*x); };
45  double F2(double x) { return (3.0*x*x); };
46  };
56 
75  template<typename ResultsType>
76  class TestingObject : public IRAD::Util::TestingObject<ResultsType>
77  {
78  typedef IRAD::Util::TestingObject<ResultsType> TestingObjectBaseType;
79  protected:
80  // Example test fixtures for OpenFoamModuleDriver testing.
81  //
82  // In a real project, there would be many test fixtures
83  // in the TestingObject.
87  std::string ExampleTestFixture;
91  std::vector<int> N;
95  std::string SourceDirPath;
96  public:
101 
105  void SetSourceDirPath(std::string input){
106  SourceDirPath = input;
107  }
108 
109 
113  virtual void Epilogue() {};
114 
122  virtual void Prologue(){
123  ExampleTestFixture.assign("ExampleTestData");
124  for(int i = 10;i < 10000000;i*=10) N.push_back(i);
125  }
126 
132  double F1(double x) { return (2.0*x); };
138  double F2(double x) { return (3.0*x*x); };
139 
145  virtual int GetInputData(std::string sourceDir, std::string destDir){
146 
147  //std::string DirName;
148  std::string OrgDir;
149 
150  //Save original working directory for later
151  OrgDir = IRAD::Sys::CWD();
152 
153  //Check if data directory exists
154  if(!IRAD::Sys::FILEEXISTS(sourceDir)){
155  std::cout << "GetInputData Error: Could not find data directory, "
156  << sourceDir << ". Exiting (fail)." << std::endl;
157  return -1;
158  }
159 
160  std::ifstream Inf;
161  std::ofstream Ouf;
162  std::string InFileName;
163  std::string OutFileName;
164  int IntDir;
165 
166  //Create destDir directory in current directory (if it doesn't
167  //already exist) to run our tests in.
168  if(!IRAD::Sys::FILEEXISTS(destDir)){
169  IntDir = IRAD::Sys::CreateDirectory(destDir);
170  if(IntDir == -1){
171  std::cout << "GetInputData Error: Could not make directory, "
172  << destDir << ". Exiting (fail)." << std::endl;
173  return -1;
174  }
175  }
176 
177  //Open the input test data directory
178  IRAD::Sys::Directory SourceDir(sourceDir);
179 
180  //Change directories to destDir directory for running
181  IntDir = IRAD::Sys::ChDir(destDir);
182  if(IntDir == -1){
183  std::cout << "GetInputData Error: Could not change directories to "
184  << destDir << ". Exiting (fail)." << std::endl;
185  return -1;
186  }
187 
188  //Copy input data to destDir directory for running
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;
193 
194  if(IRAD::Sys::ISLINK(InFileName))
195  // preserve links, don't traverse
196  int IntDir = IRAD::Sys::SymLink(InFileName, OutFileName);
197  else if(IRAD::Sys::ISDIR(InFileName)) {
198  // recursively copy directories
199  int IntDir = GetInputData(InFileName, OutFileName);
200  } else {
201  // copy files, travserse into directories recursively
202  Inf.open(InFileName.c_str());
203  Ouf.open(OutFileName.c_str());
204  Ouf << Inf.rdbuf();
205  Ouf.close();
206  Inf.close();
207  }
208  }
209 
210  //Change directories to back to original directory
211  IntDir = IRAD::Sys::ChDir(OrgDir);
212  if(IntDir == -1){
213  std::cout << "GetInputData Error: Could not change directories to "
214  << OrgDir << ". Exiting (fail)." << std::endl;
215  return -1;
216  }
217 
218  return 0;
219  }
220 
221 
227  virtual void Test__ModuleLoadUnload(ResultsType &result){
228  std::cout << "Running Test__ModuleLoad" << std::endl;
229 
230  //load OpenFoam module
231  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
232  bool works = false;
233 
234  // Get Window handle
235  int h=COM_get_window_handle("OFModule");
236  if(h <= 0){
237  std::cout << " After loading, COM_get_window_handle(\"OFModule\") returns "
238  << h << std::endl;
239  std::cout << "ModuleLoadUnload Error: Could not get window handle."
240  << std::endl;
241  }
242  else
243  works=true;
244 
245  result.UpdateResult("LoadSolverModule:Works",works);
246  if (!works)
247  return;
248 
249  //Unload OpenFoam module
250  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
251  works=false;
252 
253  //Make sure module unloaded
254  h=COM_get_window_handle("OFModule");
255  if(h > 0){
256  std::cout << "After unloading, COM_get_window_handle(\"OFModule\") returns "
257  << h << std::endl;
258  std::cout << "ModuleLoadUnload Error: Did not properly unload module."
259  << std::endl;
260  }
261  else
262  works=true;
263 
264  result.UpdateResult("UnloadSolverModule:Works",works);
265  return;
266 
267  }
268 
274  virtual void Test__LoadUnitTestData(ResultsType &result){
275  std::cout << "Running Test__LoadUnitTestData" << std::endl;
276 
277  bool works=false;
278  //Call GetInputData to copy input test data to temp directory for running tests.
279  std::string suffix = "/share/Testing/test_data/HronTurekFsi";
280  std::string dirName = SourceDirPath + suffix;
281 
282  //Make path for directory to run the test in.
283  std::string TestDir = IRAD::Sys::CWD() + "/UnitTestData";
284  int IntDir = GetInputData(dirName, TestDir);
285 
286  //Check if GetInputData exited correctly.
287  if(IntDir != 0){
288  std::cout << "LoadUnitTestData Error: GetInputData call failed."
289  << std::endl;
290  result.UpdateResult("LoadUnitTestData:Works", false);
291  return;
292  }
293 
294  //Check if TestDir directory (from GetInputData) exists in current directory
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);
299  return;
300  }
301 
302  //Save original directory name for later
303  std::string OrgDir = IRAD::Sys::CWD();
304 
305  //Change directories to TestDir directory for running
306  IntDir = IRAD::Sys::ChDir(TestDir);
307  if(IntDir == -1){
308  std::cout << "LoadUnitTestData Error: Could not change directories to "
309  << TestDir << "." << std::endl;
310  result.UpdateResult("LoadUnitTestData:Works", false);
311  return;
312  }
313  result.UpdateResult("LoadUnitTestData:Works", true);
314 
315  IntDir = IRAD::Sys::ChDir(OrgDir);
316 
317  return;
318  }
319 
325  virtual void Test__ModuleFunctionInitialize(ResultsType &result){
326  std::cout << "Running Test__ModuleFunctionInitialize" << std::endl;
327 
328  //load OpenFoam module
329  std::cout << "Before loading OFModule" << std::endl;
330  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
331  std::cout << "After loading OFModule" << std::endl;
332  bool works = false;
333 
334  // Test Initalize function exists
335  int initHandle = COM_get_function_handle("OFModule.InitFoam");
336  if(initHandle > 0)
337  works=true;
338  else {
339  std::cout << "ModuleFunctionInitialize Error: Could not get function handle."
340  << std::endl;
341  }
342  result.UpdateResult("InitFunction:Exists",works);
343  if (!works)
344  return;
345 
346  //Call GetInputData to copy input test data to temp directory for running tests.
347  std::string suffix = "/share/Testing/test_data/HronTurekFsi";
348  std::string dirName = SourceDirPath + suffix;
349  std::string testDir = IRAD::Sys::CWD() + "/UnitTestDataHTFsi";
350  int IntDir = GetInputData(dirName, testDir);
351  std::string fluidDir = testDir + "/fluid";
352  std::string OrgDir = IRAD::Sys::CWD();
353  IntDir = IRAD::Sys::ChDir(fluidDir);
354 
355  // Test proper operation of init
356  // For now, just test that the function returned 0 after running
357  // We test the "correctness" of the registered data in subsequent tests
358  int dummy1=1;
359  char *dummy2[2];
360  int verb=3;
361  dummy2[0] = const_cast<char *>(std::string("functionInit").c_str());
362  dummy2[1] = NULL;
363  COM_call_function(initHandle, &dummy1, &dummy2, &verb);
364 
365  // check the status variable to determine success of initialize
366  int* initStatus=NULL;
367  int status = COM_get_status("OFModule.initStatus",101);
368  if(status <= 0) {
369  std::cout << "ModuleFunctionInitialize Error: initStatus not a valid DataItem."
370  << "status = " << status << std::endl;
371  return;
372  }
373 
374  COM_get_array("OFModule.initStatus", 101, &initStatus);
375 
376  works=false;
377  if(*initStatus == 0)
378  works=true;
379  else {
380  std::cout << "ModuleFunctionInitialize Error: initStatus not set to zero by InitFoam."
381  << std::endl;
382  }
383  result.UpdateResult("InitFunction:Runs",works);
384 
385  // cleanup
386  IntDir = IRAD::Sys::ChDir(OrgDir);
387  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
388 
389  return;
390  }
391 
400  virtual void Test__ModuleSurfaceData(ResultsType &result){
401  std::cout << "Running Test__ModuleSurfaceData" << std::endl;
402 
403  //load OpenFoam module
404  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
405 
406  //Call GetInputData to copy input test data to temp directory for running tests.
407  std::string suffix = "/share/Testing/test_data/HronTurekFsi";
408  std::string dirName = SourceDirPath + suffix;
409  std::string testDir = IRAD::Sys::CWD() + "/UnitTestDataSurfaceData";
410  int IntDir = GetInputData(dirName, testDir);
411  std::string fluidDir = testDir + "/fluid";
412  std::string OrgDir = IRAD::Sys::CWD();
413  IntDir = IRAD::Sys::ChDir(fluidDir);
414 
415  // call init to setup the mesh
416  int dummy1=1;
417  char *dummy2[2];
418  dummy2[0] = const_cast<char *>(std::string("DataReg").c_str());
419  dummy2[1] = NULL;
420  int verb=3;
421  int initHandle = COM_get_function_handle("OFModule.InitFoam");
422  COM_call_function(initHandle, &dummy1, &dummy2, &verb);
423 
424  // list of panes in this window
425  int numPanes;
426  int* paneList;
427  COM_get_panes("OFModule", &numPanes, &paneList);
428 
429  // only one pane for serial runs
430  int pane = paneList[0];
431 
432  // check that the pressure is registered
433  int status = COM_get_status("OFModule.pressure", pane);
434  if(status <= 0) {
435  std::cout << "ModuleSurfaceData Error: pressure not a valid DataItem. "
436  << "status = " << status << std::endl;
437  result.UpdateResult("PressureData:Registered", false);
438  return;
439  } else {
440  result.UpdateResult("PressureData:Registered", true);
441  }
442 
443  // get some information about how the item was registered
444  char getDataItemLoc;
445  COM_Type getDataItemType;
446  int getDataItemComponents;
447  std::string getDataItemUnits;
448  COM_get_dataitem("OFModule.pressure", &getDataItemLoc, &getDataItemType,
449  &getDataItemComponents, &getDataItemUnits);
450 
451  double* pressure=NULL;
452  COM_get_array("OFModule.pressure", pane, &pressure);
453 
454  // check the array size against what we expect
455  // pressures are scalars stored at the cell centers
456  // assumes a single connectivity for this pane
457 
458  bool pressureCorrect = false;
459  int numPres = 0;
460  int numPresExpected = 168;
461  int numPresCompExpected = 1;
462  COM_get_size("OFModule.pressure", pane, &numPres);
463 
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;
469  } else {
470  pressureCorrect = true;
471  }
472 
473 
474  // traction
475  status = COM_get_status("OFModule.traction", pane);
476  if(status <= 0) {
477  std::cout << "ModuleSurfaceData Error: traction not a valid DataItem."
478  << "status = " << status << std::endl;
479  result.UpdateResult("TractionData:Registered", false);
480  return;
481  } else {
482  result.UpdateResult("TractionData:Registered", true);
483  }
484 
485  COM_get_dataitem("OFModule.traction", &getDataItemLoc, &getDataItemType,
486  &getDataItemComponents, &getDataItemUnits);
487 
488  double* traction=NULL;
489  COM_get_array("OFModule.traction", pane, &traction);
490 
491  // check the array size against what we expect
492  // tractions are 3-dimensional vectors stored at the cell centers
493 
494  bool tractionCorrect = false;
495  int numTrac = 0;
496  int numTracExpected = 168;
497  int numTracCompExpected = 3;
498  COM_get_size("OFModule.traction", pane, &numTrac);
499 
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;
505  } else {
506  tractionCorrect = true;
507  }
508 
509  // now step the solution and compare the pressure and traction vs what
510  // we expect from the sample problem
511  int stepHandle = COM_get_function_handle("OFModule.StepFluid");
512  COM_call_function(stepHandle);
513 
514  bool works=false;
515  //testTime = 1.e-3;
516  //toler = 1.e-9;
517  if(0)
518  works=true;
519  else {
520  std::cout << "ModuleSurfaceData Error: pressure incorrect "
521  << std::endl;
522  }
523  result.UpdateResult("PressureData:Correct", pressureCorrect);
524  result.UpdateResult("TractionData:Correct", tractionCorrect);
525 
526  // cleanup
527  IntDir = IRAD::Sys::ChDir(OrgDir);
528  //Unload OpenFoam module
529  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
530 
531  return;
532  }
533 
543  virtual void Test__ModuleFunctionStepFluid(ResultsType &result){
544  std::cout << "Running Test__ModuleFunctionStepFluid" << std::endl;
545 
546  //load OpenFoam module
547  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
548 
549  bool works = false;
550 
551 
552  //Call GetInputData to copy input test data to temp directory for running tests.
553  std::string suffix = "/share/Testing/test_data/HronTurekFsi";
554  std::string dirName = SourceDirPath + suffix;
555  std::string testDir = IRAD::Sys::CWD() + "/UnitTestDataStepTest";
556  int IntDir = GetInputData(dirName, testDir);
557  std::string fluidDir = testDir + "/fluid";
558  std::string OrgDir = IRAD::Sys::CWD();
559  IntDir = IRAD::Sys::ChDir(fluidDir);
560 
561  // call init to setup the mesh
562  int dummy1=1;
563  char *dummy2[2];
564  dummy2[0] = const_cast<char *>(std::string("StepFluid").c_str());
565  dummy2[1] = NULL;
566  int verb=3;
567  int initHandle = COM_get_function_handle("OFModule.InitFoam");
568  COM_call_function(initHandle, &dummy1, &dummy2, &verb);
569 
570  // list of panes in this window
571  int numPanes;
572  int* paneList;
573  COM_get_panes("OFModule", &numPanes, &paneList);
574 
575  // only one pane for serial runs
576  int pane = paneList[0];
577 
578  // check that the current simulation time and endTime are registered
579  int status = COM_get_status("OFModule.time", pane);
580  bool timeStatus = false;
581  if(status <= 0) {
582  std::cout << "ModuleFunctionStepFluid Error: time not a valid DataItem."
583  << "status = " << status << std::endl;
584  result.UpdateResult("TimeData:Registered", false);
585  return;
586  } else {
587  timeStatus = true;
588  }
589 
590  status = COM_get_status("OFModule.endTime", pane);
591  if(status <= 0) {
592  std::cout << "ModuleFunctionStepFluid Error: endTime not a valid DataItem."
593  << "status = " << status << std::endl;
594  result.UpdateResult("TimeData:Registered", false);
595  return;
596  } else {
597  timeStatus = timeStatus && true;
598  }
599  result.UpdateResult("TimeData:Registered", timeStatus);
600 
601  double* time=NULL;
602  COM_get_array("OFModule.time", pane, &time);
603  double* endTime=NULL;
604  COM_get_array("OFModule.endTime", pane, &endTime);
605 
606  works=false;
607  double testTime = 0.;
608  double testEndTime = 5.e-3;
609  double toler = 1.e-9;
610  if(*time - testTime < toler && *endTime - testEndTime < toler)
611  works=true;
612  else {
613  std::cout << "ModuleFunctionStepFluid Error: time or endTime initialized incorrectly"
614  << std::endl;
615  std::cout << " time = " << *time << " expected " << testTime << std::endl;
616  std::cout << " endTime = " << *endTime << " expected " << testEndTime << std::endl;
617  }
618  result.UpdateResult("TimeData:Correct",works);
619 
620  // Test StepFluid function exists
621  works = false;
622  int stepHandle = COM_get_function_handle("OFModule.StepFluid");
623  if(stepHandle > 0)
624  works=true;
625  else {
626  std::cout << "ModuleFunctionStepFluid Error: Could not get function handle."
627  << std::endl;
628  result.UpdateResult("StepFluidFunction:Exists",false);
629  return;
630  }
631  result.UpdateResult("StepFluidFunction:Exists",works);
632 
633  // Test StepFluid function steps
634  // check that the time got incremented as expected
635  COM_call_function(stepHandle);
636 
637 
638  works=false;
639  testTime = 1.e-3;
640  toler = 1.e-9;
641  if(*time - testTime < toler )
642  works=true;
643  else {
644  std::cout << "ModuleFunctionStepFluid Error: time did not increment"
645  << std::endl;
646  std::cout << " time = " << *time << "expected " << testTime << std::endl;
647  }
648  result.UpdateResult("StepFluidFunction:Steps",works);
649 
650  // cleanup
651  IntDir = IRAD::Sys::ChDir(OrgDir);
652  //Unload OpenFoam module
653  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
654 
655  return;
656  }
657 
663  virtual void Test__ModuleMeshRegistration(ResultsType &result){
664  std::cout << "Running Test__ModuleMeshRegistration" << std::endl;
665 
666  //load OpenFoam module
667  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
668 
669  // Test Initalize function exists
670  int initHandle = COM_get_function_handle("OFModule.InitFoam");
671 
672  //Call GetInputData to copy input test data to temp directory for running tests.
673  std::string suffix = "/share/Testing/test_data/HronTurekFsi";
674  std::string dirName = SourceDirPath + suffix;
675  std::string testDir = IRAD::Sys::CWD() + "/UnitTestDataMeshTest";
676  int IntDir = GetInputData(dirName, testDir);
677  std::string fluidDir = testDir + "/fluid";
678  std::string OrgDir = IRAD::Sys::CWD();
679  IntDir = IRAD::Sys::ChDir(fluidDir);
680 
681  // call init to setup the mesh
682  int dummy1=1;
683  char *dummy2[2];
684  dummy2[0] = const_cast<char *>(std::string("meshReg").c_str());
685  dummy2[1] = NULL;
686  int verb=3;
687  COM_call_function(initHandle, &dummy1, &dummy2, &verb);
688 
689  // get information about what was registered in this window
690  int numDataItems=0;
691  std::string output;
692  COM_get_dataitems("OFModule", &numDataItems, output);
693  std::istringstream Istr(output);
694  std::vector<std::string> dataItemNames;
695 
696  for (int i=0; i<numDataItems; ++i) {
697  std::string name;
698  Istr >> name;
699  dataItemNames.push_back(name);
700  std::cout << "DataItem # " << i << ": " << name << std::endl;
701  }
702 
703  // list of panes in this window
704  int numPanes;
705  int* paneList;
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;
710 
711  // only one pane for serial runs
712  int pane = paneList[0];
713 
715  // Check coordinate values
717  bool coordCorrect = false;
718  double* Coord;
719  COM_get_array("OFModule.nc", pane, &Coord);
720  if (Coord == NULL) {
721  std::cout << "In Test__ModuleMeshRegistration: No mesh coordinates registered."
722  << std::endl;
723  return;
724  } else {
725  result.UpdateResult("CoordinateData:Registered", true);
726  }
727 
728  // check for expected number of nodes
729  int numNodes = 0;
730  int numNodesExpected = 338;
731  COM_get_size("OFModule.nc", pane, &numNodes);
732 
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;
736  } else {
737  coordCorrect = true;
738  }
739 
740  // Arrays eith old data for check
741  // move to auxilary function to clean up...
742  //std::vector< std::vector<double> > CoordCheck;
743  double CoordCheck[338][3] =
744  //CoordCheck.push_back(std::vector<double> tmp(
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} };
1083 
1084  // check the node positions
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;
1092  }
1093  }
1094  }
1095  result.UpdateResult("CoordinateData:Correct", coordCorrect);
1096 
1098  // Check connectivity values
1100  bool connCorrect = true;
1101 
1102  // get connectivity tables for panes
1103  int numConn;
1104  std::string stringNames;
1105  COM_get_connectivities("OFModule", pane, &numConn, stringNames);
1106  std::istringstream ConnISS(stringNames);
1107  std::vector<std::string> connNames;
1108 
1109  for (int i=0; i<numConn; ++i) {
1110  std::string name;
1111  ConnISS >> name;
1112  connNames.push_back(name);
1113  std::cout << "Connectivity Table # " << i+1 << ": " << name << std::endl;
1114  }
1115 
1116  // number of nodes per element
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);
1124 
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;
1129 
1130  int* Conn;
1131  COM_get_array(fullConnName.c_str(), pane, &Conn);
1132 
1133  if (Conn == NULL) {
1134  std::cout << "In Test__ModuleMeshRegistration: No mesh connectivity registered."
1135  << std::endl;
1136  return;
1137  } else {
1138  result.UpdateResult("ConnectivityData:Registered", true);
1139  }
1140 
1141  // assumes a single connectivity for this pane
1142  int numElem = 0;
1143  int numElemExpected = 168;
1144  COM_get_size(fullConnName, pane, &numElem);
1145 
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;
1149  } else {
1150  connCorrect = true;
1151  }
1152 
1153  int ConnCheck[168][4] =
1154  { {1, 2, 3, 4},
1155  {3, 5, 6, 4},
1156  {5, 7, 8, 6},
1157  {7, 9, 10, 8},
1158  {9, 11, 12, 10},
1159  {11, 13, 14, 12},
1160  {13, 15, 16, 14},
1161  {15, 17, 18, 16},
1162  {17, 19, 20, 18},
1163  {19, 21, 22, 20},
1164  {21, 23, 24, 22},
1165  {23, 25, 26, 24},
1166  {25, 27, 28, 26},
1167  {27, 29, 30, 28},
1168  {29, 31, 32, 30},
1169  {31, 33, 34, 32},
1170  {33, 35, 36, 34},
1171  {35, 37, 38, 36},
1172  {37, 39, 40, 38},
1173  {39, 41, 42, 40},
1174  {41, 43, 44, 42},
1175  {43, 45, 46, 44},
1176  {47, 48, 49, 50},
1177  {51, 47, 50, 52},
1178  {53, 51, 52, 54},
1179  {55, 53, 54, 56},
1180  {57, 55, 56, 58},
1181  {59, 57, 58, 60},
1182  {61, 59, 60, 62},
1183  {63, 61, 62, 64},
1184  {65, 63, 64, 66},
1185  {67, 65, 66, 68},
1186  {69, 67, 68, 70},
1187  {71, 69, 70, 72},
1188  {73, 71, 72, 74},
1189  {75, 73, 74, 76},
1190  {77, 75, 76, 78},
1191  {79, 77, 78, 80},
1192  {81, 79, 80, 82},
1193  {83, 81, 82, 84},
1194  {85, 83, 84, 86},
1195  {87, 85, 86, 88},
1196  {89, 87, 88, 90},
1197  {91, 92, 89, 90},
1198  {93, 94, 95, 96},
1199  {96, 95, 97, 98},
1200  {98, 97, 99, 100},
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},
1261  {219, 2, 1, 220},
1262  {48, 221, 222, 49},
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} };
1322 
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;
1330  }
1331  }
1332  }
1333  result.UpdateResult("ConnectivityData:Correct", connCorrect);
1334 
1335 
1336  // cleanup
1337  IntDir = IRAD::Sys::ChDir(OrgDir);
1338  COM_free_buffer(&paneList);
1339  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSI, "OFModule");
1340 
1341  return;
1342  }
1343 
1346 
1347 
1356  virtual void Process(ResultsType &result){
1357  Prologue();
1358  Test__ModuleLoadUnload(result);
1359  Test__LoadUnitTestData(result);
1362  Test__ModuleSurfaceData(result);
1364  Epilogue();
1365  }
1366 
1373  virtual void RunTest(const std::string &name,ResultsType &result)
1374  {
1375  Prologue();
1376  if(name == "ModuleLoadUnload")
1377  Test__ModuleLoadUnload(result);
1378  else if(name == "LoadUnitTestData")
1379  Test__LoadUnitTestData(result);
1380  else if(name == "ModuleFunctionInitialize")
1382  else if(name == "ModuleMeshRegistration")
1384  else if(name == "ModuleSurfaceData")
1385  Test__ModuleSurfaceData(result);
1386  else if(name == "ModuleFunctionStepFluid")
1388  Epilogue();
1389  }
1390 
1397  virtual void ProcessTests(std::list<std::string> &test_names,ResultsType &result){
1398  Prologue();
1399  std::list<std::string>::iterator tni = test_names.begin();
1400  while(tni != test_names.end())
1401  RunTest(*tni++,result);
1402  Epilogue();
1403  }
1404 
1405 
1406  };
1407 
1412 #ifdef _OPENFOAMMODULEDRIVER_PARALLEL_
1413  template<typename CommType,typename ResultsType>
1424  class ParallelTestingObject : TestingObject<ResultsType>
1425  {
1426  protected:
1427  // Example test fixtures for parallel OpenFoamModuleDriver testing.
1428  //
1432  CommType _communicator;
1436  std::vector<int> N;
1440  std::string SourceDirPath;
1441  public:
1445  ParallelTestingObject(CommType &incomm) :
1446  TestingObject<ResultsType>(), _communicator(incomm) {};
1447  CommType &GetCommunicator() { return(_communicator); };
1448 
1452  void SetSourceDirPath(std::string input){
1453  SourceDirPath = input;
1454  }
1455 
1459  virtual void Epilogue() {};
1460 
1468  virtual void Prologue(){
1469  for(int i = _communicator.Size();i <= 1000000;i*=2) N.push_back(i);
1470  };
1471 
1477  virtual int GetInputData(std::string sourceDir, std::string destDir){
1478 
1479  //std::string DirName;
1480  std::string OrgDir;
1481 
1482  //Save original working directory for later
1483  OrgDir = IRAD::Sys::CWD();
1484 
1485  //Check if data directory exists
1486  if(!IRAD::Sys::FILEEXISTS(sourceDir)){
1487  std::cout << "GetInputData Error: Could not find data directory, "
1488  << sourceDir << ". Exiting (fail)." << std::endl;
1489  return -1;
1490  }
1491 
1492  std::ifstream Inf;
1493  std::ofstream Ouf;
1494  std::string InFileName;
1495  std::string OutFileName;
1496  int IntDir;
1497 
1498  //Create destDir directory in current directory (if it doesn't
1499  //already exist) to run our tests in.
1500  if(!IRAD::Sys::FILEEXISTS(destDir)){
1501  IntDir = IRAD::Sys::CreateDirectory(destDir);
1502  if(IntDir == -1){
1503  std::cout << "GetInputData Error: Could not make directory, "
1504  << destDir << ". Exiting (fail)." << std::endl;
1505  return -1;
1506  }
1507  }
1508 
1509  //Open the input test data directory
1510  IRAD::Sys::Directory SourceDir(sourceDir);
1511 
1512  //Change directories to destDir directory for running
1513  IntDir = IRAD::Sys::ChDir(destDir);
1514  if(IntDir == -1){
1515  std::cout << "GetInputData Error: Could not change directories to "
1516  << destDir << ". Exiting (fail)." << std::endl;
1517  return -1;
1518  }
1519 
1520  //Copy input data to destDir directory for running
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;
1525 
1526  if(IRAD::Sys::ISLINK(InFileName))
1527  // preserve links, don't traverse
1528  int IntDir = IRAD::Sys::SymLink(InFileName, OutFileName);
1529  else if(IRAD::Sys::ISDIR(InFileName)) {
1530  // recursively copy directories
1531  int IntDir = GetInputData(InFileName, OutFileName);
1532  } else {
1533  // copy files, travserse into directories recursively
1534  Inf.open(InFileName.c_str());
1535  Ouf.open(OutFileName.c_str());
1536  Ouf << Inf.rdbuf();
1537  Ouf.close();
1538  Inf.close();
1539  }
1540  }
1541 
1542 
1543  //Change directories to back to original directory
1544  IntDir = IRAD::Sys::ChDir(OrgDir);
1545  if(IntDir == -1){
1546  std::cout << "GetInputData Error: Could not change directories to "
1547  << OrgDir << ". Exiting (fail)." << std::endl;
1548  return -1;
1549  }
1550 
1551 
1552  return 0;
1553  }
1554 
1555 
1561  virtual void Test__ParModuleLoadUnload(ResultsType &result){
1562  std::cout << "Running Test__ParModuleLoadUnload" << std::endl;
1563 
1564  // changing default communicator for COM
1565  COM_set_default_communicator((GetCommunicator()).GetCommunicator());
1566 
1567  //load OpenFoam module
1568  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
1569  bool works = false;
1570 
1571  // Get Window handle
1572  int h=COM_get_window_handle("OFModule");
1573  if(h <= 0){
1574  std::cout << " After loading, COM_get_window_handle(\"OFModule\") returns "
1575  << h << std::endl;
1576  std::cout << "ParModuleLoadUnload Error: Could not get window handle."
1577  << std::endl;
1578  }
1579  else
1580  works=true;
1581 
1582  result.UpdateResult("LoadParSolverModule:Works",works);
1583  if (!works)
1584  return;
1585 
1586  //Unload OpenFoam module
1587  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
1588  works=false;
1589 
1590  //Make sure module unloaded
1591  h=COM_get_window_handle("OFModule");
1592  if(h > 0){
1593  std::cout << "After unloading, COM_get_window_handle(\"OFModule\") returns "
1594  << h << std::endl;
1595  std::cout << "ParModuleLoadUnload Error: Did not properly unload module."
1596  << std::endl;
1597  }
1598  else
1599  works=true;
1600 
1601  result.UpdateResult("UnloadParSolverModule:Works",works);
1602 
1603  return;
1604 
1605  }
1606 
1615  virtual void Test__ParCommunicatorPassToModule(ResultsType &result) {
1616  std::cout << "Running Test__ParCommunicatorPassToModule" << std::endl;
1617  bool commPass = false;
1618  // changing default communicator for COM
1619  COM_set_default_communicator((GetCommunicator()).GetCommunicator());
1620  // loading openFoamModulePar
1621  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
1622  // checking number of processes that module uses
1623  int* nProcReg;
1624  int nProc;
1625  MPI_Comm_size((GetCommunicator()).GetCommunicator(), &nProc);
1626  COM_get_array("OFModule.nproc", 0, &nProcReg);
1627  if (*nProcReg == nProc)
1628  commPass = true;
1629  // unloading the module
1630  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
1631  // setting test flag
1632  result.UpdateResult("CommunicatorPassToModule:Pass",commPass);
1633 
1634  }
1635 
1636 
1642  virtual void Test__ParLoadUnitTestData(ResultsType &result){
1643  std::cout << "Running Test__ParLoadUnitTestData" << std::endl;
1644 
1645  //Call GetInputData to copy input test data to temp directory for running tests.
1646  std::string suffix = "/share/Testing/test_data/HronTurekFsiPar";
1647  std::string dirName = SourceDirPath + suffix;
1648 
1649  //Make path for directory to run the test in.
1650  std::string TestDir = IRAD::Sys::CWD() + "/UnitTestDataPar";
1651  int IntDir = 0;
1652  if ((GetCommunicator()).Rank() == 0)
1653  IntDir = GetInputData(dirName, TestDir);
1654 
1655  //creating a barrier to let copy process finish the job
1656  (GetCommunicator()).Barrier();
1657 
1658  //Check if GetInputData exited correctly.
1659  if(IntDir != 0){
1660  std::cout << "ParLoadUnitTestData Error: GetInputData call failed."
1661  << std::endl;
1662  result.UpdateResult("ParLoadUnitTestData:Works", false);
1663  return;
1664  }
1665 
1666  //Check if TestDir directory (from GetInputData) exists in current directory
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);
1671  return;
1672  }
1673 
1674  //Save original directory name for later
1675  std::string OrgDir = IRAD::Sys::CWD();
1676 
1677  //Change directories to TestDir directory for running
1678  IntDir = IRAD::Sys::ChDir(TestDir);
1679  if(IntDir == -1){
1680  std::cout << "ParLoadUnitTestData Error: Could not change directories to "
1681  << TestDir << "." << std::endl;
1682  result.UpdateResult("ParLoadUnitTestData:Works", false);
1683  return;
1684  }
1685  result.UpdateResult("ParLoadUnitTestData:Works", true);
1686 
1687  IntDir = IRAD::Sys::ChDir(OrgDir);
1688 
1689  return;
1690  }
1691 
1697  virtual void Test__ParModuleFunctionInitialize(ResultsType &result){
1698  std::cout << "Running Test__ParModuleFunctionInitialize" << std::endl;
1699  int myRank = (GetCommunicator()).Rank();
1700 
1701  //load OpenFoam module
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;
1705  bool works = false;
1706 
1707  // Test Initalize function exists
1708  int initHandle = COM_get_function_handle("OFModule.InitFoam");
1709  if(initHandle > 0)
1710  works=true;
1711  else {
1712  std::cout << "ModuleFunctionInitialize Error: Could not get function handle."
1713  << std::endl;
1714  }
1715  result.UpdateResult("ParInitFunction:Exists",works);
1716  if (!works)
1717  return;
1718 
1719  //Call GetInputData to copy input test data to temp directory for running tests.
1720  std::string suffix = "/share/Testing/test_data/HronTurekFsiPar";
1721  std::string dirName = SourceDirPath + suffix;
1722  std::string testDir = IRAD::Sys::CWD() + "/UnitTestDataHTFsiPar";
1723  int IntDir;
1724  if (myRank == 0){
1725  std::cout << "Started copying data..." << std::endl;
1726  IntDir = GetInputData(dirName, testDir);
1727  std::cout << "Finished copying data..." << std::endl;
1728  }
1729  // setting a barrier to finish copy step
1730  (GetCommunicator()).Barrier();
1731  std::string fluidDir = testDir + "/fluid";
1732  std::string OrgDir = IRAD::Sys::CWD();
1733  IntDir = IRAD::Sys::ChDir(fluidDir);
1734 
1735 
1736  // Test proper operation of init
1737  // For now, just test that the function returned 0 after running
1738  // We test the "correctness" of the registered data in subsequent tests
1739  int dummy1=2;
1740  char *dummy2[2];
1741  int verb=3;
1742  dummy2[0] = const_cast<char *>("functionInit");
1743  dummy2[1] = const_cast<char *>("-parallel");
1744  COM_call_function(initHandle, &dummy1, &dummy2, &verb);
1745 
1746  // check the status variable to determine success of initialize
1747  int* initStatus=NULL;
1748  int status = COM_get_status("OFModule.initStatus",200+myRank);
1749  if(status <= 0) {
1750  std::cout << "ModuleFunctionInitialize Error: initStatus not a valid DataItem."
1751  << "status = " << status << std::endl;
1752  return;
1753  }
1754 
1755  COM_get_array("OFModule.initStatus", 200 + myRank, &initStatus);
1756 
1757  works=false;
1758  if(*initStatus == 0)
1759  works=true;
1760  else {
1761  std::cout << "ModuleFunctionInitialize Error: initStatus not set to zero by InitFoam."
1762  << std::endl;
1763  }
1764 
1765  result.UpdateResult("ParInitFunction:Runs",works);
1766 
1767  // cleanup
1768  IntDir = IRAD::Sys::ChDir(OrgDir);
1769  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
1770 
1771  return;
1772  }
1773 
1782  virtual void Test__ParModuleSurfaceData(ResultsType &result){
1783  std::cout << "Running Test__ParModuleSurfaceData" << std::endl;
1784 
1785  //registering the rank for process
1786  int myRank = GetCommunicator().Rank();
1787 
1788  //load OpenFoam module
1789  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
1790 
1791  //Call GetInputData to copy input test data to temp directory for running tests.
1792  std::string suffix = "/share/Testing/test_data/HronTurekFsiPar";
1793  std::string dirName = SourceDirPath + suffix;
1794  std::string testDir = IRAD::Sys::CWD() + "/UnitTestDataParSurfaceData";
1795  int IntDir;
1796  if (myRank == 0)
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);
1802 
1803  // call init to setup the mesh
1804  int dummy1=2;
1805  char *dummy2[2];
1806  dummy2[0] = const_cast<char *>("DataReg");
1807  dummy2[1] = const_cast<char *>("-parallel");
1808  int verb=3;
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();
1813 
1814  // list of panes in this window
1815  int numPanes;
1816  int* paneList;
1817  COM_get_panes("OFModule", &numPanes, &paneList);
1818 
1819  // assuming only one pane per process
1820  int pane = paneList[0];
1821  std::cout << "Rank "<< myRank << " numPanes = " << numPanes << std::endl;
1822  std::cout << "Rank "<< myRank << " pane ID = " << pane << std::endl;
1823 
1824  // check that the pressure is registered
1825  int status = COM_get_status("OFModule.pressure", pane);
1826  if(status <= 0) {
1827  std::cout << "ParModuleSurfaceData Error: pressure not a valid DataItem. "
1828  << "status = " << status << std::endl;
1829  result.UpdateResult("ParPressureData:Registered", false);
1830  return;
1831  } else {
1832  result.UpdateResult("ParPressureData:Registered", true);
1833  }
1834 
1835  // get some information about how the item was registered
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);
1842 
1843  double* pressure=NULL;
1844  COM_get_array("OFModule.pressure", pane, &pressure);
1845 
1846  // check the array size against what we expect
1847  // pressures are scalars stored at the cell centers
1848  // assumes a single connectivity for this pane
1849 
1850  bool pressureCorrect = false;
1851  int numPres = 0;
1852  std::vector<int> numPresExpected;
1853  numPresExpected.push_back(154);
1854  numPresExpected.push_back(14);
1855  int numPresCompExpected = 1;
1856 
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;
1864  } else {
1865  pressureCorrect = true;
1866  }
1867 
1868 
1869  // traction
1870  status = COM_get_status("OFModule.traction", pane);
1871  if(status <= 0) {
1872  std::cout << "ParModuleSurfaceData Error: traction not a valid DataItem."
1873  << "status = " << status << std::endl;
1874  result.UpdateResult("ParTractionData:Registered", false);
1875  return;
1876  } else {
1877  result.UpdateResult("ParTractionData:Registered", true);
1878  }
1879 
1880  COM_get_dataitem("OFModule.traction", &getDataItemLoc, &getDataItemType,
1881  &getDataItemComponents, &getDataItemUnits);
1882 
1883  double* traction=NULL;
1884  COM_get_array("OFModule.traction", pane, &traction);
1885 
1886  // check the array size against what we expect
1887  // tractions are 3-dimensional vectors stored at the cell centers
1888 
1889  bool tractionCorrect = false;
1890  int numTrac = 0;
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);
1896 
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;
1903  } else {
1904  tractionCorrect = true;
1905  }
1906 
1907  result.UpdateResult("ParPressureData:Correct", pressureCorrect);
1908  result.UpdateResult("ParTractionData:Correct", tractionCorrect);
1909 
1910  // cleanup
1911  IntDir = IRAD::Sys::ChDir(OrgDir);
1912  //Unload OpenFoam module
1913  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
1914 
1915  return;
1916  }
1917 
1923  virtual void Test__ParModuleMeshRegistration(ResultsType &result){
1924  std::cout << "Running Test__ParModuleMeshRegistration" << std::endl;
1925  int myRank = (GetCommunicator()).Rank();
1926 
1927  //load OpenFoam module
1928  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
1929 
1930  // Test Initalize function exists
1931  int initHandle = COM_get_function_handle("OFModule.InitFoam");
1932 
1933  //Call GetInputData to copy input test data to temp directory for running tests.
1934  std::string suffix = "/share/Testing/test_data/HronTurekFsiPar";
1935  std::string dirName = SourceDirPath + suffix;
1936  std::string testDir = IRAD::Sys::CWD() + "/UnitTestDataParMeshTest";
1937  int IntDir;
1938  if (myRank == 0)
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);
1944 
1945  // call init to setup the mesh
1946  int dummy1=2;
1947  char *dummy2[2];
1948  dummy2[0] = const_cast<char *>("meshReg");
1949  dummy2[1] = const_cast<char *>("-parallel");
1950  int verb=3;
1951  COM_call_function(initHandle, &dummy1, &dummy2, &verb);
1952 
1953  // get information about what was registered in this window
1954  int numDataItems=0;
1955  std::string output;
1956  COM_get_dataitems("OFModule", &numDataItems, output);
1957  std::istringstream Istr(output);
1958  std::vector<std::string> dataItemNames;
1959 
1960  for (int i=0; i<numDataItems; ++i) {
1961  std::string name;
1962  Istr >> name;
1963  dataItemNames.push_back(name);
1964  std::cout << "Rank #"
1965  << myRank << ", DataItem # " << i << ": " << name << std::endl;
1966  }
1967 
1968  // list of panes in this window
1969  int numPanes;
1970  int* paneList;
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;
1975 
1976  // assuming only one pane per process
1977  int pane = paneList[0];
1978 
1980  // Check coordinate values
1982  bool coordCorrect = false;
1983  double* Coord;
1984  COM_get_array("OFModule.nc", pane, &Coord);
1985  if (Coord == NULL) {
1986  std::cout << "In Test__ParModuleMeshRegistration: No mesh coordinates registered."
1987  << std::endl;
1988  return;
1989  } else {
1990  result.UpdateResult("ParCoordinateData:Registered", true);
1991  }
1992 
1993  // check for expected number of nodes
1994  int numNodes = 0;
1995  std::vector<int> numNodesExpected;
1996  numNodesExpected.push_back(312);
1997  numNodesExpected.push_back(30);
1998  COM_get_size("OFModule.nc", pane, &numNodes);
1999 
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;
2003  } else {
2004  coordCorrect = true;
2005  }
2006 
2007  // Arrays with old data for check
2008  // move to auxilary function to clean up...
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}};
2322 
2323 
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} };
2355 
2356  // check the node positions
2357  for(int i=0; i < numNodes; i++) {
2358  //std::cout << "{";
2359  for(int j=0; j < 3; j++){
2360  //std::cout << Coord[i*3+j];
2361  //if (j<2)
2362  // std::cout << ", ";
2363  if (myRank == 0) {
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;
2369  }
2370  } else {
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;
2376  }
2377  }
2378  }
2379  //std::cout << "}," << std::endl;
2380  }
2381  result.UpdateResult("ParCoordinateData:Correct", coordCorrect);
2382 
2384  // Check connectivity values
2386  bool connCorrect = true;
2387 
2388  // get connectivity tables for panes
2389  int numConn;
2390  std::string stringNames;
2391  COM_get_connectivities("OFModule", pane, &numConn, stringNames);
2392  std::istringstream ConnISS(stringNames);
2393  std::vector<std::string> connNames;
2394 
2395  for (int i=0; i<numConn; ++i) {
2396  std::string name;
2397  ConnISS >> name;
2398  connNames.push_back(name);
2399  std::cout << "Connectivity Table # " << i+1 << ": " << name << std::endl;
2400  }
2401 
2402  // number of nodes per element
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);
2410 
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;
2415 
2416  int* Conn;
2417  COM_get_array(fullConnName.c_str(), pane, &Conn);
2418 
2419  if (Conn == NULL) {
2420  std::cout << "In Test__ParModuleMeshRegistration: No mesh connectivity registered."
2421  << std::endl;
2422  return;
2423  } else {
2424  result.UpdateResult("ParConnectivityData:Registered", true);
2425  }
2426 
2427  // assumes a single connectivity for this pane
2428  int numElem = 0;
2429  std::vector<int> numElemExpected;
2430  numElemExpected.push_back(154);
2431  numElemExpected.push_back(14);
2432  COM_get_size(fullConnName, pane, &numElem);
2433 
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;
2437  } else {
2438  connCorrect = true;
2439  }
2440 
2441  int ConnCheck0[154][4] =
2442  { {1, 2, 3, 4},
2443  {3, 5, 6, 4},
2444  {5, 7, 8, 6},
2445  {7, 9, 10, 8},
2446  {9, 11, 12, 10},
2447  {11, 13, 14, 12},
2448  {13, 15, 16, 14},
2449  {15, 17, 18, 16},
2450  {17, 19, 20, 18},
2451  {19, 21, 22, 20},
2452  {21, 23, 24, 22},
2453  {23, 25, 26, 24},
2454  {25, 27, 28, 26},
2455  {27, 29, 30, 28},
2456  {29, 31, 32, 30},
2457  {31, 33, 34, 32},
2458  {33, 35, 36, 34},
2459  {35, 37, 38, 36},
2460  {37, 39, 40, 38},
2461  {39, 41, 42, 40},
2462  {41, 43, 44, 42},
2463  {43, 45, 46, 44},
2464  {47, 48, 49, 50},
2465  {51, 47, 50, 52},
2466  {53, 51, 52, 54},
2467  {55, 53, 54, 56},
2468  {57, 55, 56, 58},
2469  {59, 57, 58, 60},
2470  {61, 59, 60, 62},
2471  {63, 61, 62, 64},
2472  {65, 63, 64, 66},
2473  {67, 65, 66, 68},
2474  {69, 67, 68, 70},
2475  {71, 69, 70, 72},
2476  {73, 71, 72, 74},
2477  {75, 73, 74, 76},
2478  {77, 75, 76, 78},
2479  {79, 77, 78, 80},
2480  {81, 79, 80, 82},
2481  {83, 81, 82, 84},
2482  {85, 83, 84, 86},
2483  {87, 85, 86, 88},
2484  {89, 87, 88, 90},
2485  {91, 92, 89, 90},
2486  {93, 94, 95, 96},
2487  {94, 97, 98, 95},
2488  {97, 99, 100, 98},
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},
2540  {201, 2, 1, 202},
2541  {48, 203, 204, 49},
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} };
2596 
2597  int ConnCheck1[14][4] =
2598  { {1, 2, 3, 4},
2599  {4, 3, 5, 6},
2600  {6, 5, 7, 8},
2601  {8, 7, 9, 10},
2602  {9, 11, 12, 10},
2603  {11, 13, 14, 12},
2604  {13, 15, 16, 14},
2605  {15, 17, 18, 16},
2606  {17, 19, 20, 18},
2607  {21, 22, 23, 24},
2608  {22, 25, 26, 23},
2609  {25, 27, 28, 26},
2610  {27, 29, 30, 28},
2611  {29, 2, 1, 30} };
2612 
2613 
2614  for(int i=0; i < numElem; i++){
2615  //std::cout << "{";
2616  for(int j=0; j < numElementNodes; j++){
2617  //std::cout<<Conn[i*numElementNodes+j];
2618  //if (j<3)
2619  // std::cout<<", ";
2620  if (myRank==0) {
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;
2626  }
2627  } else {
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;
2633  }
2634  }
2635  }
2636  //std::cout <<"},"<<std::endl;
2637  }
2638  result.UpdateResult("ParConnectivityData:Correct", connCorrect);
2639 
2640 
2641  // cleanup
2642  IntDir = IRAD::Sys::ChDir(OrgDir);
2643  COM_free_buffer(&paneList);
2644  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
2645 
2646  return;
2647  }
2648 
2658  virtual void Test__ParModuleFunctionStepFluid(ResultsType &result){
2659  std::cout << "Running Test__ParModuleFunctionStepFluid" << std::endl;
2660  int myRank = (GetCommunicator()).Rank();
2661 
2662  //load OpenFoam module
2663  COM_LOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
2664 
2665  bool works = false;
2666 
2667  //Call GetInputData to copy input test data to temp directory for running tests.
2668  std::string suffix = "/share/Testing/test_data/HronTurekFsiPar";
2669  std::string dirName = SourceDirPath + suffix;
2670  std::string testDir = IRAD::Sys::CWD() + "/UnitTestDataParStepTest";
2671  int IntDir;
2672  if (myRank == 0){
2673  // copy test information
2674  GetInputData(dirName, testDir);
2675  }
2676  (GetCommunicator()).Barrier();
2677  std::string fluidDir = testDir + "/fluid";
2678  std::string OrgDir = IRAD::Sys::CWD();
2679  IntDir = IRAD::Sys::ChDir(fluidDir);
2680 
2681  // call init to setup the mesh
2682  int dummy1=2;
2683  char *dummy2[2];
2684  dummy2[0] = const_cast<char *>("StepFluid");
2685  dummy2[1] = const_cast<char *>("-parallel");
2686  int verb=3;
2687  int initHandle = COM_get_function_handle("OFModule.InitFoam");
2688  COM_call_function(initHandle, &dummy1, &dummy2, &verb);
2689 
2690  // list of panes in this window
2691  int numPanes;
2692  int* paneList;
2693  COM_get_panes("OFModule", &numPanes, &paneList);
2694 
2695  // assuming only one pane per process
2696  int pane = paneList[0];
2697 
2698  // check that the current simulation time and endTime are registered
2699  int status = COM_get_status("OFModule.time", pane);
2700  bool timeStatus = false;
2701  if(status <= 0) {
2702  std::cout << "ModuleFunctionParStepFluid Error: time not a valid DataItem."
2703  << "status = " << status << std::endl;
2704  result.UpdateResult("ParTimeData:Registered", false);
2705  return;
2706  } else {
2707  timeStatus = true;
2708  }
2709 
2710  status = COM_get_status("OFModule.endTime", pane);
2711  if(status <= 0) {
2712  std::cout << "ParModuleFunctionStepFluid Error: endTime not a valid DataItem."
2713  << "status = " << status << std::endl;
2714  result.UpdateResult("ParTimeData:Registered", false);
2715  return;
2716  } else {
2717  timeStatus = timeStatus && true;
2718  }
2719  result.UpdateResult("ParTimeData:Registered", timeStatus);
2720 
2721  double* time=NULL;
2722  COM_get_array("OFModule.time", pane, &time);
2723  double* endTime=NULL;
2724  COM_get_array("OFModule.endTime", pane, &endTime);
2725 
2726  works=false;
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)
2731  works=true;
2732  else {
2733  std::cout << "ParModuleFunctionStepFluid Error: time or endTime initialized incorrectly"
2734  << std::endl;
2735  std::cout << " time = " << *time << " expected " << testTime << std::endl;
2736  std::cout << " endTime = " << *endTime << " expected " << testEndTime << std::endl;
2737  }
2738  result.UpdateResult("ParTimeData:Correct",works);
2739 
2740  // Initializing setProbe needed for stepFluid operation
2741  std::string newDataItemName = "OFModule.setsProb";
2742  COM_new_dataitem(newDataItemName.c_str(),'w',COM_INT,1,"");
2743  int setsProb = 0;
2744  COM_set_array((newDataItemName).c_str(),0,&setsProb);
2745 
2746  // Test StepFluid function exists
2747  works = false;
2748  int stepHandle = COM_get_function_handle("OFModule.StepFluid");
2749  if(stepHandle > 0)
2750  works=true;
2751  else {
2752  std::cout << "ParModuleFunctionStepFluid Error: Could not get function handle."
2753  << std::endl;
2754  result.UpdateResult("ParStepFluidFunction:Exists",false);
2755  return;
2756  }
2757  result.UpdateResult("ParStepFluidFunction:Exists",works);
2758 
2759  // Test StepFluid function steps
2760  // check that the time got incremented as expected
2761  COM_call_function(stepHandle);
2762 
2763 
2764  works=false;
2765  testTime = 5.e-4;
2766  toler = 1.e-9;
2767  if (std::fabs(*time - testTime) < toler )
2768  works=true;
2769  else {
2770  std::cout << "ParModuleFunctionStepFluid Error: time did not increment"
2771  << std::endl;
2772  std::cout << " time = " << *time << "expected " << testTime << std::endl;
2773  }
2774  result.UpdateResult("ParStepFluidFunction:Steps",works);
2775 
2776  // cleanup
2777  IntDir = IRAD::Sys::ChDir(OrgDir);
2778  //Unload OpenFoam module
2779  COM_UNLOAD_MODULE_STATIC_DYNAMIC(OpenFoamFSIPar, "OFModule");
2780 
2781  return;
2782  }
2783 
2792  virtual void Process(ResultsType &result){
2793  Prologue();
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);
2801  Epilogue();
2802  }
2803 
2810  virtual void RunTest(const std::string &name,ResultsType &result)
2811  {
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);
2826  }
2827 
2834  virtual void ProcessTests(std::list<std::string> &test_names,ResultsType &result){
2835  Prologue();
2836  std::list<std::string>::iterator tni = test_names.begin();
2837  while(tni != test_names.end())
2838  RunTest(*tni++,result);
2839  Epilogue();
2840  }
2841 
2842 
2843  };
2844 #endif
2845 };
2846 #endif
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)
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)