BasicTools.IO.MeshWriter module

Mesh file writer

BasicTools.IO.MeshWriter.CheckIntegrity(GUI=False)[source]
BasicTools.IO.MeshWriter.CreateMeshWriterBinary(ops)[source]
class BasicTools.IO.MeshWriter.MeshWriter[source]

Bases: WriterBase

Class to write Unstructured mesh on disk in the mesh format file

CheckPos(value)[source]
Close()[source]
CloseSolutionFileAscii()[source]
CloseSolutionFileBinary()[source]
GetDimensionFromMesh(meshObject)[source]

Returns dimension of the mesh

Parameters:

meshObject (UnstructuredMesh) – mesh for which the dimension is returned

Returns:

dimension of the mesh

Return type:

int

OpenSolutionFile(support)[source]
OpenSolutionFileAscii(support)[source]
OpenSolutionFileBinary(support)[source]
SetFileName(fileName)[source]

Sets the name of the output file

Parameters:

fileName (str) – name of the output file

SetSinglePrecision(single=True)[source]

Sets the output precision to single precision

Parameters:

single (bool, optional) – if True, output is save in singe precision, by default True

SetVersion(version: int)[source]

Sets the output file format version

Parameters:

version (int) – format version

Write(meshObject, PointFields=None, solutionOnOwnFile=False, nodalRefNumber=None, elemRefNumber=None, PointFieldsNames=None, CellFieldsNames=None, CellFields=None)[source]

Write mesh to file in mesh format

Parameters:
  • meshObject (UnstructuredMesh) – the mesh to be written

  • PointFields (list[np.ndarray], optional) – list of fields defined at the vertices of the mesh, to be included in the output file, by default None

  • solutionOnOwnFile (bool, optional) – if True, the solution is written in a separate file, by default False

  • nodalRefNumber (np.ndarray, optional) – a provided numbering for the vertices, by default None

  • elemRefNumber (np.ndarray, optional) – a provided numbering for the elements, by default None

  • PointFieldsNames (None) – Not Used, by default None

  • CellFieldsNames (None) – Not Used, by default None

  • CellFields (None) – Not Used, by default None

WriteASCII(meshObject, PointFields=None, solutionOnOwnFile=False, nodalRefNumber=None, elemRefNumber=None)[source]

Write mesh to file in binary mesh format

Parameters:
  • meshObject (UnstructuredMesh) – the mesh to be written

  • PointFields (list[np.ndarray], optional) – list of fields defined at the vertices of the mesh, to be included in the output file, by default None

  • solutionOnOwnFile (bool, optional) – if True, the solution is written in a separate file, by default False

  • nodalRefNumber (np.ndarray, optional) – a provided numbering for the vertices, by default None

  • elemRefNumber (np.ndarray, optional) – a provided numbering for the elements, by default None

WriteBINARY(meshObject, PointFields=None, solutionOnOwnFile=False, nodalRefNumber=None, elemRefNumber=None)[source]

Write mesh to file in binary mesh format

Parameters:
  • meshObject (UnstructuredMesh) – the mesh to be written

  • PointFields (list[np.ndarray], optional) – list of fields defined at the vertices of the mesh, to be included in the output file, by default None

  • solutionOnOwnFile (bool, optional) – if True, the solution is written in a separate file, by default False

  • nodalRefNumber (np.ndarray, optional) – a provided numbering for the vertices, by default None

  • elemRefNumber (np.ndarray, optional) – a provided numbering for the elements, by default None

WriteInt(value)[source]
WriteIntArray(intArray)[source]
WriteKeyWord(keyword)[source]
WritePos(value)[source]
WriteSolutionsFields(meshObject, PointFields=None, SolsAtTriangles=None, SolsAtTetrahedra=None)[source]
WriteSolutionsFieldsAscii(meshObject, PointFields=None, SolsAtTriangles=None, SolsAtTetrahedra=None)[source]
WriteSolutionsFieldsBinary(meshObject, PointFields=None, SolsAtTriangles=None, SolsAtTetrahedra=None)[source]
BasicTools.IO.MeshWriter.WriteMesh(fileName, mesh, PointFields=None, solutionOnOwnFile=False, binary=True, nodalRefNumber=None, elemRefNumber=None)[source]
Export Mesh to disk in the mesh format file.

A file is created using the path and name of fileName

Parameters:
  • fileName (str) – name with path to the file to be created (relative or absolute)

  • mesh (UnstructuredMesh) – the mesh to be written

  • PointFields (list[np.ndarray], optional) – list of fields defined at the vertices of the mesh, to be included in the output file, by default None

  • solutionOnOwnFile (bool, optional) – if True, the solution is written in a separate file, by default False

  • binary (bool, optional) – if True, a binary file is produced, by default True

  • nodalRefNumber (np.ndarray, optional) – a provided numbering for the vertices, by default None

  • elemRefNumber (np.ndarray, optional) – a provided numbering for the elements, by default None