BasicTools.IO.ZebulonIO module
Read various objects created by and for Zset
- BasicTools.IO.ZebulonIO.GetBehavior(materialFileName)[source]
Gets the behavior defined in a material file
- Parameters:
materialFileName (str) – name of the material file in which the behavior is defined
- Returns:
behavior to retrieve
- Return type:
str
- BasicTools.IO.ZebulonIO.GetBoundaryConditions(data)[source]
Returns a dictionary containing the infos of an inp file “data” read by ReadInp2() concerning all the infos respecting
****calcul, ``***bc`- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
- Returns:
boundary conditions of an inp file in the form of a dict
- Return type:
dict
- BasicTools.IO.ZebulonIO.GetDensity(materialFileName)[source]
Gets the density defined in a material file
- Parameters:
materialFileName (str) – name of the material file in which the density is defined
- Returns:
density to retrieve
- Return type:
float
- BasicTools.IO.ZebulonIO.GetFromInp(data, dic)[source]
Returns a list of lists containing the elements of each line of the inp file “data” read by ReadInp2() respecting the conditions in dic: for example, for dic = {‘4’:[‘calcul’], ‘2’:[‘file’, ‘temperature’]}, the function returns all the lines being in a
****section starting by “simulate” and a**section starting by “file temperature” (robust with respect to the number of spaces between ‘file’ and ‘temperature’)- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
dic (dict) – conditions for restricting the information of the inp file to extract
- Returns:
internal format discribing the content of an restricted inp file in the form of nested lists
- Return type:
list
- BasicTools.IO.ZebulonIO.GetInitDofValues(data)[source]
Returns a tuple containing the infos of an inp file “data” read by ReadInp2() concerning all the infos respecting
****calcul,***init_dof_value- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
- Returns:
initial values of the solution defined in an inp file
- Return type:
tuple
- BasicTools.IO.ZebulonIO.GetInputTimeSequence(data)[source]
Reconstructs the time sequence to be computed by the Zset solver from the inp file
- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
- Returns:
time sequence to be computed by the Zset solver
- Return type:
list[float]
- BasicTools.IO.ZebulonIO.GetLoadings(data)[source]
Returns a dictionary containing the infos of an inp file “data” read by ReadInp2() concerning all the infos respecting bc and temperature
- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
- Returns:
loadings (including boundary conditions) of an inp file in the form of a dict
- Return type:
dict
- BasicTools.IO.ZebulonIO.GetMaterialFiles(data)[source]
Returns a dictionary containing the material file data
- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
- Returns:
material file data defined in an inp file
- Return type:
dict
- BasicTools.IO.ZebulonIO.GetMeshFileName(data)[source]
Returns the mesh name defined in a inp file
- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
- Returns:
mesh name defined in a inp file
- Return type:
str
- BasicTools.IO.ZebulonIO.GetParameterFiles(data, parameterName=None)[source]
Returns a dictionary containing the infos of an inp file “data” read by ReadInp2() concerning all the infos respecting
****calcul,***parameter,**file!! only with ‘cycle_conversion’ time tableextract floats from string: solution from https://stackoverflow.com/questions/4703390/how-to-extract-a-floating-number-from-a-string
- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
parameterName (str, optional) – The name of the parameter file name to read, by default None
- Returns:
parameter file data defined in an inp file
- Return type:
dict
- BasicTools.IO.ZebulonIO.GetProblemType(data)[source]
Returns the problem type defined in a inp file
- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
- Returns:
problem type defined in a inp file
- Return type:
str
- BasicTools.IO.ZebulonIO.GetTables(data)[source]
Returns a dictionary containing the infos of an inp file “data” read by ReadInp2() concerning all the infos respecting
****calcul,***tableand**nameor**cycle.- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
- Returns:
tables of an inp file in the form of a dict
- Return type:
dict
- BasicTools.IO.ZebulonIO.ReadBinaryFile(fileName)[source]
Reads a binary data vector generated by Zset
- Parameters:
fileName (str) – The name of the file to read
- Returns:
read data vector
- Return type:
np.ndarray
- BasicTools.IO.ZebulonIO.ReadInp(fileName=None, string=None)[source]
Function that performs the reading of the Zset inp file dictionary-based reader: WARNING: multiple entry keys may be overwritten !!
- Parameters:
fileName (str, optional) – The name of the file to read, by default None
string (str, optional) – the string to read in the case of reading from memory, by default None
- Returns:
internal format discribing the content of an inp file
- Return type:
OrderedDict
- BasicTools.IO.ZebulonIO.ReadInp2(fileName=None, string=None, rootpath=None, startingNstar=4)[source]
Reads an Zset inp files and return the results in nested lists
- Parameters:
fileName (str, optional) – The name of the file to read, by default None
string (str, optional) – the string to read in the case of reading from memory, by default None
rootpath (str, optional) – directory containing the file to read, by default None
startingNstar (int, optional) – Zset command context (in number of stars), by default 4
- Returns:
internal format discribing the content of an inp file in the form of nested lists
- Return type:
list
- BasicTools.IO.ZebulonIO.ReadMat(fileName, symetry=True, returnReorderOnly=False)[source]
Reads a matrix generated by Zset
- Parameters:
fileName (str) – name of the file where the matrix to read is stored
symetry (bool, optional) – if True, the matrix is symmetric, by default True
returnReorderOnly (bool, optional) – if True, returns only reorder indices, by default False
- Returns:
matrix of reorder indices
- Return type:
csr_matrix or lst
- BasicTools.IO.ZebulonIO.ReadVec(fileName, dtype=<class 'float'>)[source]
Reads Zset vector
- Parameters:
fileName (str) – name of the file where the vector to read is stored
dtype (type, optional) – type of data to read, by default float
- Returns:
read vector
- Return type:
np.ndarray
- BasicTools.IO.ZebulonIO.StringReader(inputString, folder)[source]
Converts string from Zset input file into cleaned string, robust with respect to (potentially nested) ‘@include’
- Parameters:
inputString (str) – string respecting the Zset inp file format
folder (str) – directory containing the files linked by ‘@include’ commands
- Returns:
cleaned string
- Return type:
str
- BasicTools.IO.ZebulonIO.WriteInp(data, output=None)[source]
Function that performs the writing of a Zset inp file dictionary-based reader: WARNING: multiple entry keys may be overwritten !!
- Parameters:
data (OrderedDict) – internal format discribing the content of an inp file
output (_io.TextIOWrapper, optional) – output writen, by default None
- BasicTools.IO.ZebulonIO.WriteInp2(data, output=None)[source]
Function that performs the writing of a Zset inp file constructed by the function ReadInp2
- Parameters:
data (list) – internal format discribing the content of an inp file in the form of nested lists
output (_io.TextIOWrapper, optional) – output writen, by default None