Esempio n. 1
0
 def testVerboseSimulation(self):
     pathIN = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                           "Generators.IN")
     pathOUT = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                            "Generators.verbose.OUT")
     data = OpenFLUID.openDataset(pathIN)
     OpenFLUID.setCurrentOutputDir(pathOUT)
     self.assertRaises(Exception, OpenFLUID.runSimulation(data, True))
Esempio n. 2
0
 def testProjectSimulation(self):
     path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         "Generators.PRJ")
     pathOUT = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                            "Generators.PRJ", "OUT")
     data = OpenFLUID.openProject(path)
     OpenFLUID.setCurrentOutputDir(pathOUT)
     self.assertRaises(Exception, OpenFLUID.runSimulation(data))
Esempio n. 3
0
 def testSimulation(self):
     pathIN = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                           "Generators.IN")
     pathOUT = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                            "Generators.OUT")
     OpenFLUID.setCurrentOutputDir(pathOUT)
     data = OpenFLUID.openDataset(pathIN)
     #    self.assertEqual(OpenFLUID.getSimulationOutputDir(data),pathOUT)
     self.assertRaises(Exception, OpenFLUID.runSimulation(data))
Esempio n. 4
0
    def testObserversPaths(self):
        print(OpenFLUID.getObserversPaths())

        self.assertEqual(len(OpenFLUID.getExtraObserversPaths()), 0)

        OpenFLUID.addExtraObserversPaths("/path/obs/10")
        self.assertEqual(OpenFLUID.getExtraObserversPaths(), ["/path/obs/10"])

        OpenFLUID.addExtraObserversPaths("/path/obs/20")
        self.assertEqual(len(OpenFLUID.getExtraObserversPaths()), 2)
        self.assertEqual(sorted(OpenFLUID.getExtraObserversPaths()),
                         sorted(["/path/obs/10", "/path/obs/20"]))

        OpenFLUID.addExtraObserversPaths(["/path/obs/30", "/path/obs/40"])
        self.assertEqual(len(OpenFLUID.getExtraObserversPaths()), 4)

        OpenFLUID.resetExtraObserversPaths()
        self.assertEqual(len(OpenFLUID.getExtraObserversPaths()), 0)
        self.assertEqual(OpenFLUID.getExtraObserversPaths(), [])

        OpenFLUID.addExtraObserversPaths(["/path/obs/50", "/path/obs/50"])
        self.assertEqual(len(OpenFLUID.getExtraObserversPaths()), 1)
Esempio n. 5
0
    def testSimulatorsPaths(self):
        print(OpenFLUID.getSimulatorsPaths())

        self.assertEqual(len(OpenFLUID.getExtraSimulatorsPaths()), 0)

        OpenFLUID.addExtraSimulatorsPaths("/path/sim/1")
        self.assertEqual(OpenFLUID.getExtraSimulatorsPaths(), ["/path/sim/1"])

        OpenFLUID.addExtraSimulatorsPaths("/path/sim/2")
        self.assertEqual(len(OpenFLUID.getExtraSimulatorsPaths()), 2)
        self.assertEqual(sorted(OpenFLUID.getExtraSimulatorsPaths()),
                         sorted(["/path/sim/1", "/path/sim/2"]))

        OpenFLUID.addExtraSimulatorsPaths(["/path/sim/3", "/path/sim/4"])
        self.assertEqual(len(OpenFLUID.getExtraSimulatorsPaths()), 4)

        OpenFLUID.resetExtraSimulatorsPaths()
        self.assertEqual(len(OpenFLUID.getExtraSimulatorsPaths()), 0)
        self.assertEqual(OpenFLUID.getExtraSimulatorsPaths(), [])

        OpenFLUID.addExtraSimulatorsPaths(["/path/sim/5", "/path/sim/5"])
        self.assertEqual(len(OpenFLUID.getExtraSimulatorsPaths()), 1)
Esempio n. 6
0
 def testBlob(self):
     b = OpenFLUID.newBlob()
     OpenFLUID.deleteBlob(b)
Esempio n. 7
0
 def testVersion(self):
     print(OpenFLUID.getVersion())
Esempio n. 8
0
 def testProject(self):
     path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         "Generators.PRJ")
     data = OpenFLUID.openProject(path)
     OpenFLUID.printSimulationInfo(data)
Esempio n. 9
0
 def testDataset(self):
     path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
                         "6fields_3reaches.IN")
     data = OpenFLUID.openDataset(path)
     OpenFLUID.printSimulationInfo(data)