Peano
Loading...
Searching...
No Matches
peano4.visualisation.input.PatchFileParser.PatchFileParser Class Reference

Parser for Peano block file output. More...

Public Member Functions

 __init__ (self, file_path, set_identifier, subdomain_number)
 
 __repr__ (self)
 
 parse_file (self)
 Read file and return cell data, dimensions, number of degrees of freedom and number of unknowns.
 
 render_or_validate_for_each_unknown (self, render_or_validate)
 We need to call the render function for each filter on a variety of attributes, and then return them if they are modified.
 

Data Fields

 file_path
 
 is_data_associated_to_cell
 
 dimensions
 
 set_identifier
 
 subdomain_number
 
 parsed
 
 file_contains_patches
 
 unknown_attributes
 

Private Member Functions

 __parse_meta_data_region (self, current_line, file_object, end_condition)
 Pass in file object, move it along and return it.
 
 __parse_patch_region (self, current_line, file_object, end_condition="end patch")
 Pass in file object, run it until we encounter the end condition, and then return it.
 

Detailed Description

Parser for Peano block file output.

This class should be instantiated from within the Visualiser class. This class should be called once per patch file that contains patch data that we want to render. The main method that is called is parse_file().

This method doesn't return anything. Rather, it sets unknown_attributes to capture all the patch data for each of the unknowns that we find.

Then, the Visualiser class will steal this data, and combine it into its own helper class.

Attributes:

file_path: String String of input file path (including filename and extension)

dimensions: Integer Dimension of domains

mapping: series of d-dimensional tuples Distorts the domain

set_identifier: String Can be empty to parse everything.

unknown_attributes: Dict{ String, UnknownAttributes } Dictionary that has the names of each unknown we wanna capture as its keys, and the values are the helper class which captures dimensions, cell data etc. Each of the unknowns should be listed during the metadata part of the patch file, ie between "begin cell-metadata" and "end cell-metadata".

Definition at line 125 of file PatchFileParser.py.

Constructor & Destructor Documentation

◆ __init__()

peano4.visualisation.input.PatchFileParser.PatchFileParser.__init__ ( self,
file_path,
set_identifier,
subdomain_number )

Definition at line 163 of file PatchFileParser.py.

Member Function Documentation

◆ __parse_meta_data_region()

peano4.visualisation.input.PatchFileParser.PatchFileParser.__parse_meta_data_region ( self,
current_line,
file_object,
end_condition )
private

◆ __parse_patch_region()

peano4.visualisation.input.PatchFileParser.PatchFileParser.__parse_patch_region ( self,
current_line,
file_object,
end_condition = "end patch" )
private

Pass in file object, run it until we encounter the end condition, and then return it.

We assume that current_line == "begin patch file" at this stage

This is where we read the actual data

Definition at line 237 of file PatchFileParser.py.

References exahype2.symhype.FirstOrderConservativePDEFormulation.FirstOrderConservativePDEFormulation.dimensions, exahype2.symhype.PDE.PDE.dimensions, peano4.visualisation.input.PatchFileParser.UnknownAttributes.dimensions, peano4.visualisation.input.PatchFileParser.PatchFileParser.dimensions, convert::data::PatchData.dimensions, convert::data::Variable.dimensions, mghype.api.matrixgenerators.DLinear.DLinear.dimensions, mghype.api.matrixgenerators.DLinearMassIdentity.DLinearMassIdentity.dimensions, mghype.api.matrixgenerators.GaussLobatto.GaussLobatto.dimensions, mghype.api.matrixgenerators.GaussLobatto.GLMatrixFree.dimensions, mghype.api.matrixgenerators.MatrixGenerator.MatrixGenerator.dimensions, equations.acoustic.Acoustic.dimensions, equations.advection.Advection.dimensions, equations.elastic.Elastic.dimensions, equations.equation.Equation.dimensions, equations.euler.Euler.dimensions, equations.swe.SWE_W_Bathymetry.dimensions, equations.swe.SWE_WO_Bathymetry.dimensions, peano4.visualisation.input.PatchFileParser.PatchFileParser.file_contains_patches, peano4.visualisation.input.PatchFileParser.UnknownAttributes.is_data_associated_to_cell, peano4.visualisation.input.PatchFileParser.PatchFileParser.is_data_associated_to_cell, peano4.visualisation.input.PatchFileParser.PatchFileParser.set_identifier, peano4.visualisation.input.Patch.Patch.subdomain_number, peano4.visualisation.input.PatchFileParser.PatchFileParser.subdomain_number, and peano4.visualisation.input.PatchFileParser.PatchFileParser.unknown_attributes.

Referenced by peano4.visualisation.input.PatchFileParser.PatchFileParser.parse_file().

Here is the caller graph for this function:

◆ __repr__()

peano4.visualisation.input.PatchFileParser.PatchFileParser.__repr__ ( self)

Definition at line 181 of file PatchFileParser.py.

◆ parse_file()

peano4.visualisation.input.PatchFileParser.PatchFileParser.parse_file ( self)

Read file and return cell data, dimensions, number of degrees of freedom and number of unknowns.

Parameters:

set_identifier: String Name of the set of unknowns we want to extract. If this is the empty string then I parse all content.

Todo
: clean up the loop below. we can separate into getting metadata, and then reading patches

Definition at line 305 of file PatchFileParser.py.

References peano4.visualisation.input.PatchFileParser.PatchFileParser.__parse_meta_data_region(), peano4.visualisation.input.PatchFileParser.PatchFileParser.__parse_patch_region(), exahype2.symhype.FirstOrderConservativePDEFormulation.FirstOrderConservativePDEFormulation.dimensions, exahype2.symhype.PDE.PDE.dimensions, peano4.visualisation.input.PatchFileParser.UnknownAttributes.dimensions, peano4.visualisation.input.PatchFileParser.PatchFileParser.dimensions, convert::data::PatchData.dimensions, convert::data::Variable.dimensions, mghype.api.matrixgenerators.DLinear.DLinear.dimensions, mghype.api.matrixgenerators.DLinearMassIdentity.DLinearMassIdentity.dimensions, mghype.api.matrixgenerators.GaussLobatto.GaussLobatto.dimensions, mghype.api.matrixgenerators.GaussLobatto.GLMatrixFree.dimensions, mghype.api.matrixgenerators.MatrixGenerator.MatrixGenerator.dimensions, equations.acoustic.Acoustic.dimensions, equations.advection.Advection.dimensions, equations.elastic.Elastic.dimensions, equations.equation.Equation.dimensions, equations.euler.Euler.dimensions, equations.swe.SWE_W_Bathymetry.dimensions, equations.swe.SWE_WO_Bathymetry.dimensions, peano4.visualisation.input.PatchFileParser.PatchFileParser.file_path, int, peano4.visualisation.input.PatchFileParser.UnknownAttributes.is_data_associated_to_cell, peano4.visualisation.input.PatchFileParser.PatchFileParser.is_data_associated_to_cell, peano4.visualisation.input.PatchFileParser.PatchFileParser.parsed, and peano4.visualisation.input.PatchFileParser.PatchFileParser.set_identifier.

Here is the call graph for this function:

◆ render_or_validate_for_each_unknown()

peano4.visualisation.input.PatchFileParser.PatchFileParser.render_or_validate_for_each_unknown ( self,
render_or_validate )

We need to call the render function for each filter on a variety of attributes, and then return them if they are modified.

We do this in a functional style, ie the Visualiser class contains all of the filters we wish to apply, and we pass the render function that we intend to use back to this layer. Ugly, but we need to do some looping over the different unknowns we see in the patch files, and I thought it best to hide that from the parse_snapshot region of the vis code.

The same apply for the validate function from the Visualiser file as well.

Definition at line 387 of file PatchFileParser.py.

References peano4.visualisation.input.PatchFileParser.PatchFileParser.unknown_attributes.

Field Documentation

◆ dimensions

peano4.visualisation.input.PatchFileParser.PatchFileParser.dimensions

Definition at line 167 of file PatchFileParser.py.

Referenced by peano4.visualisation.input.PatchFileParser.PatchFileParser.__parse_meta_data_region(), peano4.visualisation.input.PatchFileParser.PatchFileParser.__parse_patch_region(), exahype2.symhype.PDE.PDE._implementation_of_mapping_onto_named_quantities(), peano4.visualisation.input.PatchFileParser.UnknownAttributes._initialise_default_mapping_if_no_mapping_specified(), mghype.api.matrixgenerators.MatrixGenerator.MatrixGenerator.convert_index_to_dim(), equations.euler.Euler.eigenvalues(), mghype.api.matrixgenerators.MatrixGenerator.MatrixGenerator.eval_integral(), equations.elastic.Elastic.flux(), equations.euler.Euler.flux(), mghype.api.matrixgenerators.GaussLobatto.GLMatrixFree.get_boundary_matrix(), mghype.api.matrixgenerators.GaussLobatto.GLMatrixFree.get_cell_from_face_matrix(), mghype.api.matrixgenerators.DLinear.DLinear.get_cell_identity_matrix(), mghype.api.matrixgenerators.DLinearMassIdentity.DLinearMassIdentity.get_cell_identity_matrix(), mghype.api.matrixgenerators.DLinear.DLinear.get_cell_mass_matrix(), mghype.api.matrixgenerators.DLinear.DLinear.get_cell_system_matrix_for_laplacian(), mghype.api.matrixgenerators.DLinearMassIdentity.DLinearMassIdentity.get_cell_system_matrix_for_laplacian(), api.solvers.DiscontinuousGalerkinDiscretisation.AssemblePetscMatrix.get_constructor_body(), mghype.api.matrixgenerators.MatrixGenerator.MatrixGenerator.get_deriv(), mghype.api.matrixgenerators.MatrixGenerator.MatrixGenerator.get_points_for_dimension(), mghype.api.matrixgenerators.MatrixGenerator.MatrixGenerator.get_polynomial(), mghype.api.matrixgenerators.GaussLobatto.GLMatrixFree.get_projection_matrices(), mghype.api.matrixgenerators.MatrixGenerator.MatrixGenerator.get_weights_for_dimension(), matrices.DgGenerator.getCellToFaceMatrix(), exahype2.symhype.FirstOrderConservativePDEFormulation.FirstOrderConservativePDEFormulation.implementation_of_eigenvalues(), exahype2.symhype.FirstOrderConservativePDEFormulation.FirstOrderConservativePDEFormulation.implementation_of_flux(), exahype2.symhype.FirstOrderConservativePDEFormulation.FirstOrderConservativePDEFormulation.implementation_of_max_eigenvalue(), exahype2.symhype.FirstOrderConservativePDEFormulation.FirstOrderConservativePDEFormulation.implementation_of_ncp(), and peano4.visualisation.input.PatchFileParser.PatchFileParser.parse_file().

◆ file_contains_patches

peano4.visualisation.input.PatchFileParser.PatchFileParser.file_contains_patches

◆ file_path

peano4.visualisation.input.PatchFileParser.PatchFileParser.file_path

◆ is_data_associated_to_cell

◆ parsed

peano4.visualisation.input.PatchFileParser.PatchFileParser.parsed

◆ set_identifier

peano4.visualisation.input.PatchFileParser.PatchFileParser.set_identifier

◆ subdomain_number

peano4.visualisation.input.PatchFileParser.PatchFileParser.subdomain_number

◆ unknown_attributes


The documentation for this class was generated from the following file: