# containerType = Name of the container factory
#
componentName = "MEDFactory"
-corbaModule = "MEDCalc"
+corbaModule = "MEDCALC"
containerType = "FactoryServer"
import salome
# Use cases of the MEDDataManager for data loading
# ==================================================
#
-def TEST_MEDDataManager_getMeshList():
+def TEST_MEDDataManager_getMeshHandlerList():
dataManager = factory.getDataManager()
datasourceHandler = dataManager.loadDatasource(testFilePath)
- meshHandlerList = dataManager.getMeshList(datasourceHandler.id)
+ meshHandlerList = dataManager.getMeshHandlerList(datasourceHandler.id)
print(meshHandlerList)
if len(meshHandlerList) == 0:
def TEST_MEDDataManager_getMesh():
dataManager = factory.getDataManager()
datasourceHandler = dataManager.loadDatasource(testFilePath)
- meshHandlerList = dataManager.getMeshList(datasourceHandler.id)
+ meshHandlerList = dataManager.getMeshHandlerList(datasourceHandler.id)
for mRef in meshHandlerList:
meshId = mRef.id
- mRes = dataManager.getMesh(meshId)
+ mRes = dataManager.getMeshHandler(meshId)
print(mRes)
if ( mRes.name != mRef.name ) or ( mRes.sourceid != mRef.sourceid):
return False
dataManager = factory.getDataManager()
datasourceHandler = dataManager.loadDatasource(testFilePath)
- meshHandlerList = dataManager.getMeshList(datasourceHandler.id)
+ meshHandlerList = dataManager.getMeshHandlerList(datasourceHandler.id)
# We look for the fieldseries defined on the first mesh of the list
meshId = meshHandlerList[0].id
fieldseriesList = dataManager.getFieldseriesListOnMesh(meshId)
testFilePath = getFilePath("timeseries.med")
datasourceHandler = dataManager.loadDatasource(testFilePath)
- meshHandlerList = dataManager.getMeshList(datasourceHandler.id)
+ meshHandlerList = dataManager.getMeshHandlerList(datasourceHandler.id)
# We look for the fieldseries defined on the first mesh of the list
meshId = meshHandlerList[0].id
fieldseriesList = dataManager.getFieldseriesListOnMesh(meshId)
return False
return True
+def TEST_MEDDataManager_getFieldIdAtTimestamp():
+ dataManager = factory.getDataManager()
+ testFilePath = os.path.join(RESDIR,testFileName)
+
+ testFilePath = getFilePath("timeseries.med")
+ datasourceHandler = dataManager.loadDatasource(testFilePath)
+
+ meshHandlerList = dataManager.getMeshHandlerList(datasourceHandler.id)
+ # We look for the fieldseries defined on the first mesh of the list
+ meshId = meshHandlerList[0].id
+ fieldseriesList = dataManager.getFieldseriesListOnMesh(meshId)
+ # We look for the fields defined in the first fieldseries,
+ # i.e. the time steps for this field.
+ fieldseriesId = fieldseriesList[0].id
+ requestedTimestamp8 = 8
+ fieldId8 = dataManager.getFieldIdAtTimestamp(fieldseriesId, requestedTimestamp8)
+ timestamp8 = dataManager.getFieldTimestamp(fieldId8)
+ print("fieldId8: ", fieldId8)
+ print("timestamp8: ", timestamp8)
+ requestedTimestamp9 = 9
+ fieldId9 = dataManager.getFieldIdAtTimestamp(fieldseriesId, 9)
+ timestamp9 = dataManager.getFieldTimestamp(fieldId9)
+ print("fieldId9: ", fieldId9)
+ print("timestamp9: ", timestamp9)
+
+ if (timestamp8!=requestedTimestamp8):
+ return False
+ if (timestamp9!=requestedTimestamp9):
+ return False
+ return True
+
#
# ==================================================
# Use cases of the MEDCalculator
self.assertTrue(TEST_saveFields())
# === MEDDataManager (data request functions)
- def test_MEDDataManager_getMeshList(self):
- self.assertTrue(TEST_MEDDataManager_getMeshList())
+ def test_MEDDataManager_getMeshHandlerList(self):
+ self.assertTrue(TEST_MEDDataManager_getMeshHandlerList())
def test_MEDDataManager_getMesh(self):
self.assertTrue(TEST_MEDDataManager_getMesh())
def test_MEDDataManager_getFieldListInFieldseries(self):
self.assertTrue(TEST_MEDDataManager_getFieldListInFieldseries())
+ def test_MEDDataManager_getFieldIdAtTimestamp(self):
+ self.assertTrue(TEST_MEDDataManager_getFieldIdAtTimestamp())
+
# === MEDCalculator (need MEDDataManager)
def test_Calculator_basics(self):
self.assertTrue(TEST_Calculator_basics())