Commit 792dba47 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

rewrite readMsh and rename to readIdx

parent e2e4b25f
Pipeline #1172 passed with stage
in 27 minutes and 33 seconds
......@@ -422,7 +422,7 @@ for i in range(0,nbSteps):
if (i == nbStart and i > 0):
loadFile=exportBaseDir + '/' + loadDirName + '/solution/solution-0'+str(nbStart)+'.idx'
print ('Reloading solution ',loadFile)
solution.readMsh(loadFile)
solution.importIdx(loadFile)
# if (i%10000==0 and i > nbStart):
# print ('Writing solution for reload')
# solutionExporter.exportIdx(i, t)
......
......@@ -42,7 +42,7 @@ groups.splitFaceGroupsByOrientation(extrusion, ["bottom_bottom_surf", "top_botto
claw = dgEulerAtmLaw(dimension)
####Load reference solution from file###
reloaded =dgDofContainer(groups,claw.getNbFields())
reloaded.readMsh("refSolERK"+str(period)+"/subwindow3/subwindow3.idx")
reloaded.importIdx("refSolERK"+str(period)+"/subwindow3/subwindow3.idx")
solution = dgDofContainer(groups, claw.getNbFields())
XYZ = groups.getFunctionCoordinates();
......
......@@ -56,8 +56,8 @@ groups.splitGroupsByPhysicalTag();
claw = dgEulerAtmLaw(dimension)
####Load reference solution from file###
reloaded =dgDofContainer(groups,claw.getNbFields())
#reloaded.readMsh("refSolERK/refSolERK.idx")
reloaded.readMsh("refSolERK/subwindow8/subwindow8.idx")
#reloaded.importIdx("refSolERK/refSolERK.idx")
reloaded.importIdx("refSolERK/subwindow8/subwindow8.idx")
solution = dgDofContainer(groups, claw.getNbFields())
XYZ = groups.getFunctionCoordinates();
......@@ -158,7 +158,7 @@ thetap=functionPython(1, getThetap, [solution.getFunction(), XYZ])
####Load initial solution from file###
readInit =dgDofContainer(groups,claw.getNbFields())
readInit.readMsh("refSolERK/subwindow6/subwindow6.idx")
readInit.importIdx("refSolERK/subwindow6/subwindow6.idx")
solution.copy(readInit)
rhoHs = dgDofContainer(groups, 1)
......
......@@ -218,7 +218,7 @@ print 'Smallest element\'s surface is', minSurface, 'msq, Largest element\'s sur
bathDC = dgDofContainer(groups, 1);
if(os.path.exists("./Bath/"+simMesh+"_bath_smooth/"+simMesh+"_bath_smooth.idx")):
print(colored('Importing bathymetry ...',"red"))
bathDC.readMsh("./Bath/"+simMesh+"_bath_smooth/"+simMesh+"_bath_smooth.idx")
bathDC.importIdx("./Bath/"+simMesh+"_bath_smooth/"+simMesh+"_bath_smooth.idx")
else:
print(colored('**** ERROR: Bathymetry file does not exist! ****',"red"))
#-------------------------------------------------------------------------------
......@@ -518,7 +518,7 @@ for n in range(1,LP_TotIter+1):
print 'Problem in loadedSolutions!'
else:
print '-> simSolution not already loaded. Loading it from file. m is:', m, '. File is (gbr-%06d'%( iterNumberWanted )+').'
simSolution.readMsh(simOutputDir+'/mr-gbr/mr-gbr-%06d'%( iterNumberWanted )+'.idx')
simSolution.importIdx(simOutputDir+'/mr-gbr/mr-gbr-%06d'%( iterNumberWanted )+'.idx')
loadedSolutions[0] = iterNumberWanted
else:
......@@ -545,7 +545,7 @@ for n in range(1,LP_TotIter+1):
else:
print '-> simSolutionUnder not already loaded. Loading it from file. l is:', l, '. File is (gbr-%06d'%( iterNumberWanted-l )+').'
t_solUnder = simStartTime + float(iterNumberWanted-l)*simDt
simSolutionUnder.readMsh(simOutputDir+'/mr-gbr/mr-gbr-%06d'%( iterNumberWanted-l )+'.idx')
simSolutionUnder.importIdx(simOutputDir+'/mr-gbr/mr-gbr-%06d'%( iterNumberWanted-l )+'.idx')
loadedSolutions[2] = iterNumberWanted-l
m=0
......@@ -570,7 +570,7 @@ for n in range(1,LP_TotIter+1):
else:
print '-> simSolutionOver not already loaded. Loading it from file. m is:', m, '. File is (gbr-%06d'%( iterNumberWanted+m )+').'
t_solOver = simStartTime + float(iterNumberWanted+m)*simDt
simSolutionOver.readMsh(simOutputDir+'/mr-gbr/mr-gbr-%06d'%( iterNumberWanted+m )+'.idx')
simSolutionOver.importIdx(simOutputDir+'/mr-gbr/mr-gbr-%06d'%( iterNumberWanted+m )+'.idx')
loadedSolutions[1] = iterNumberWanted+m
scaleFactor = 1.0 - (t-t_solUnder)/(t_solOver-t_solUnder)
......
......@@ -178,7 +178,7 @@ solution = dgDofContainer(groups, claw.getNbFields())
bathDC = dgDofContainer(groups, 1)
if(os.path.exists("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")):
Msg.Info("Smoothed bathymetry already exists.")
bathDC.readMsh("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
bathDC.importIdx("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
Msg.Info("Smoothed bathymetry read.")
else:
diffuseBathymetry(groups, UTMtoLonLatDegrees, bathDC, filename)
......@@ -196,7 +196,7 @@ reefsDCfilename = "GBR_Functions/reefsFunction_"+filename+"/reefsFunction_"+file
if(os.path.exists(reefsDCfilename)):
if (Msg.GetCommRank() == 0):
print 'Reef Map file found: '+reefsDCfilename+' ; loading this.'
reefsDC.readMsh(reefsDCfilename)
reefsDC.importIdx(reefsDCfilename)
else:
if (Msg.GetCommRank() == 0):
print 'Reef Map file '+reefsDCfilename+' not found. Loading reef map ...'
......@@ -209,7 +209,7 @@ else:
#3. Delete reefs object data
reefsObj.clearReefsData()
Msg.Barrier()
reefsDC.readMsh(reefsDCfilename)
reefsDC.importIdx(reefsDCfilename)
# ************************************************
......@@ -463,7 +463,7 @@ else:
# ** OPTIONAL 1/3: Load an existing DC as the initial solution DC
if (startFromExistingSolution == 1):
solution.readMsh( solutionFileName )
solution.importIdx( solutionFileName )
# **********************************************
......
......@@ -112,7 +112,7 @@ bathDC = dgDofContainer(groups, 1)
if(os.path.exists("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")):
Msg.Info("Smoothed bathymetry already exists.")
bathDC.readMsh("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
bathDC.importIdx("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
Msg.Info("Smoothed bathymetry read.")
else:
Msg.Fatal("You need to run DiffuseBathGBR_Standalone first!")
......@@ -131,7 +131,7 @@ reefsDCfilename = "GBR_Functions/reefsFunction_"+filename+"/reefsFunction_"+file
if(os.path.exists(reefsDCfilename)):
if (Msg.GetCommRank() == 0):
print 'Reef Map file found: '+reefsDCfilename+' ; loading this.'
reefsDC.readMsh(reefsDCfilename)
reefsDC.importIdx(reefsDCfilename)
else:
if (Msg.GetCommRank() == 0):
print 'Reef Map file '+reefsDCfilename+' not found. Loading reef map ...'
......@@ -294,7 +294,7 @@ solution = dgDofContainer(groups, claw.getNbFields())
# ** OPTIONAL 1/3: Load an existing DC as the initial solution DC
if (startFromExistingSolution == 1):
solution.readMsh( solutionFileName )
solution.importIdx( solutionFileName )
# **********************************************
......
......@@ -72,7 +72,7 @@ bathDC = dgDofContainer(groups, 1);
if(not os.path.exists("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")):
Msg.Fatal('No valid bathymetry file found, please launch "rundgpy DiffuseBathGBR.py"')
Msg.Info("Smoothed bathymetry already exists.")
bathDC.readMsh("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
bathDC.importIdx("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
Msg.Info("Smoothed bathymetry read.")
# Define Conservation Law
......
......@@ -69,7 +69,7 @@ bathDC = dgDofContainer(groups, 1);
if(not os.path.exists("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")):
Msg.Fatal('No valid bathymetry file found, please launch "rundgpy DiffuseBathGBR.py"')
Msg.Info("Smoothed bathymetry already exists.")
bathDC.readMsh("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
bathDC.importIdx("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
Msg.Info("Smoothed bathymetry read.")
# Define Conservation Law
......
......@@ -87,7 +87,7 @@ bathDC = dgDofContainer(groups, 1)
if(os.path.exists("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")):
Msg.Info("Smoothed bathymetry already exists.")
bathDC.readMsh("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
bathDC.importIdx("./Bath/"+filename+"_bath_smooth/"+filename+"_bath_smooth.idx")
Msg.Info("Smoothed bathymetry read.")
else:
Msg.Fatal("You need to run DiffuseBathGBR_Standalone first!")
......@@ -106,7 +106,7 @@ reefsDCfilename = "GBR_Functions/reefsFunction_"+filename+"/reefsFunction_"+file
if(os.path.exists(reefsDCfilename)):
if (Msg.GetCommRank() == 0):
print ('Reef Map file found: '+reefsDCfilename+' ; loading this.')
reefsDC.readMsh(reefsDCfilename)
reefsDC.importIdx(reefsDCfilename)
else:
if (Msg.GetCommRank() == 0):
print ('Reef Map file '+reefsDCfilename+' not found. Loading reef map ...')
......@@ -199,7 +199,7 @@ solution = dgDofContainer(groups, claw.getNbFields())
# ** OPTIONAL 1/3: Load an existing DC as the initial solution DC
if (startFromExistingSolution == 1):
solution.readMsh( solutionFileName )
solution.importIdx( solutionFileName )
# **********************************************
......
......@@ -24,7 +24,7 @@ if(not os.path.exists(bathname)):
Msg.Fatal('No valid bathymetry file :' + bathname + ' found, please launch "rundgpy DiffuseBathymetryTsunami.py"')
bath = dgDofContainer(groups, 1);
bath.readMsh(bathname)
bath.importIdx(bathname)
def tide (f):
for i in range(0,f.size1()):
......
......@@ -19,7 +19,7 @@ bath = dgDofContainer(groups, 1);
if(not os.path.exists(bathname)):
Msg.Fatal('No valid bathymetry file :' + bathname + ' found, please launch "rundgpy DiffuseBathymetryTsunami.py"')
bath.readMsh(bathname)
bath.importIdx(bathname)
# Define Conservation Law
claw = dgConservationLawShallowWater2d()
solution = dgDofContainer(groups, claw.getNbFields())
......
......@@ -14,7 +14,7 @@ bath = dgDofContainer(groups, 1);
bathname=outputDir+"/"+filename+"_bath_smooth"+"/"+filename+"_bath_smooth.idx"
if(os.path.exists(bathname)):
bath.readMsh(bathname)
bath.importIdx(bathname)
else:
Msg.Fatal("No corresponding bathymetry file, launch DiffuseBathymetryTsunami.py")
......
......@@ -14,7 +14,7 @@ bath = dgDofContainer(groups, 1);
bathname=outputDir+"/"+filename+"_bath_smooth"+"/"+filename+"_bath_smooth.idx"
if(os.path.exists(bathname)):
bath.readMsh(bathname)
bath.importIdx(bathname)
else:
Msg.Fatal("No corresponding bathymetry file, launch DiffuseBathymetryTsunami.py")
......
......@@ -15,7 +15,7 @@ bath = dgDofContainer(gr, 1);
if(os.path.exists(outputDir+"/"+filename+"_bath_smooth"+"/"+filename+"_bath_smooth.idx")):
Msg.Info('.... Import Default Smoothed Bathymetry')
bath.readMsh(outputDir+"/"+filename+"_bath_smooth"+"/"+filename+"_bath_smooth.idx")
bath.importIdx(outputDir+"/"+filename+"_bath_smooth"+"/"+filename+"_bath_smooth.idx")
else:
Msg.Fatal("No corresponding bathymetry file")
claw = dgConservationLawShallowWater2d()
......
......@@ -14,7 +14,7 @@ bath = dgDofContainer(groups, 1);
bathname=outputDir+"/"+filename+"_bath_smooth"+"/"+filename+"_bath_smooth.idx"
if(os.path.exists(bathname)):
bath.readMsh(bathname)
bath.importIdx(bathname)
else:
Msg.Fatal("No corresponding bathymetry file, launch DiffuseBathymetryTsunami.py")
......@@ -24,7 +24,7 @@ FCoriolis= functionC(tlib, "coriolis", 1, [xyz])
claw = dgConservationLawShallowWater2d()
solution = dgDofContainer(groups, claw.getNbFields())
solution.interpolate(Finit)
#solution.readMsh(outputDir+"/"+filename+"_sol"+"/"+filename+"_sol.idx")
#solution.importIdx(outputDir+"/"+filename+"_sol"+"/"+filename+"_sol.idx")
claw.setBathymetry(bath.getFunction())
claw.setBathymetryGradient(bath.getFunctionGradient())
claw.setCoriolisFactor(FCoriolis)
......
......@@ -14,7 +14,7 @@ bathname=outputDir+"/"+filename+"_bath_smooth"+"/"+filename+"_bath_smooth.idx"
Msg.Barrier()
if(os.path.exists(bathname)):
Msg.Info('.... Import Default Smoothed Bathymetry')
bath.readMsh(bathname)
bath.importIdx(bathname)
else:
Msg.Fatal("No correct bathymetry file, launch DiffuseBathymetryTsunami.py")
......
......@@ -38,7 +38,7 @@ if(not os.path.exists(bathname)):
Msg.Fatal('No valid bathymetry file :' + bathname + ' found, please launch "rundgpy DiffuseBathymetryTsunami.py"')
bath = dgDofContainer(groups, 1);
bath.readMsh(bathname)
bath.importIdx(bathname)
# ************************************************
......
......@@ -19,7 +19,7 @@ bath = dgDofContainer(groups, 1);
if(not os.path.exists(bathname)):
Msg.Fatal('No valid bathymetry file :' + bathname + ' found, please launch "rundgpy DiffuseBathymetryTsunami.py"')
bath.readMsh(bathname)
bath.importIdx(bathname)
# Define Conservation Law
claw = dgConservationLawShallowWater2d()
solution = dgDofContainer(groups, claw.getNbFields())
......
......@@ -17,7 +17,7 @@ groups = dgGroupCollection(model, dimension, order, stereo)
XYZ = groups.getFunctionCoordinates();
claw = dgConservationLawShallowWater2d()
bath = dgDofContainer(groups, 1);
bath.readMsh(bathname)
bath.importIdx(bathname)
solution = dgDofContainer(groups, claw.getNbFields())
Finit = functionC(tlib, "initial_condition_okada_honshu",3, [XYZ])
solution.interpolate(Finit)
......
......@@ -21,7 +21,7 @@ def loadAndPartitionMesh(model, fileName, ng, algo) :
if(not os.path.exists(bathname)):
Msg.Fatal('No valid bathymetry file :' + bathname + ' found, please launch "rundgpy DiffuseBathymetryTsunami.py"')
bath.readMsh(bathname)
bath.importIdx(bathname)
claw = dgConservationLawShallowWater2d()
solution = dgDofContainer(groups, claw.getNbFields())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment