Peano
Loading...
Searching...
No Matches
peano4.Project.Project Class Reference

Represents a Peano 4 project. More...

Inheritance diagram for peano4.Project.Project:
Collaboration diagram for peano4.Project.Project:

Public Member Functions

 __init__ (self, namespace, project_name, directory=".", subdirectory="", executable="")
 project_name Simple string.
 
 __str__ (self)
 
 set_fenv_handler (self, args)
 
 cleanup (self)
 This routine has to be called after you've generated your code.
 
 generate (self, overwrite=peano4.output.Overwrite.Default, throw_away_data_after_generation=False)
 Generate all code.
 
 build (self, make=True, make_clean_first=True, throw_away_data_after_build=False, number_of_parallel_builds=-1)
 Invokes the underlying make build mechanism on the project.
 
 run (self, executable, args=[], prefix=None, pipefile=None, rebuild_if_required=True)
 Runs the code.
 
 add_subproject (self, 'Project' subproject, master=False)
 Adds a new Peano4 project into this Peano 4 project.
 
 subdirectory (self)
 

Data Fields

 rootnamespace
 
 namespace
 
 namespaces
 
 subdirectories
 
 project_name
 
 directory
 
 subdirectory
 
 output
 
 datamodel
 
 solversteps
 
 main
 
 is_generated
 
 is_built
 
 build_was_successful
 
 constants
 
 subconstants
 
 is_extended
 

Protected Attributes

 _subdirectory
 

Detailed Description

Represents a Peano 4 project.

namespace Sequence of strings representing the (nested) namespace. Pass in [ "examples", "algebraicmg" ] for example if you wanna write a solver that is embedded into the namespace examples::algebraicmg.

Global project properties

If you want to alter some global constants, you should manipulate the constants attribute. It will eventually feed into the generated file Constants.h. See peano4.output.Constants for further info.

Definition at line 16 of file Project.py.

Constructor & Destructor Documentation

◆ __init__()

peano4.Project.Project.__init__ ( self,
namespace,
project_name,
directory = ".",
subdirectory = "",
executable = "" )

project_name Simple string.

Definition at line 34 of file Project.py.

Member Function Documentation

◆ __str__()

peano4.Project.Project.__str__ ( self)

Definition at line 87 of file Project.py.

References peano4.Project.Project.datamodel, and peano4.Project.Project.solversteps.

Referenced by peano4.toolbox.particles.postprocessing.ParticleVTUReader.VTUParticleSet.__repr__().

Here is the caller graph for this function:

◆ add_subproject()

peano4.Project.Project.add_subproject ( self,
'Project' subproject,
master = False )

Adds a new Peano4 project into this Peano 4 project.

assert( lhs.namespace == rhs.namespace ), "namespaces of the projects being merged don't match"

assert( lhs.directory == rhs.directory ), "directories of the projects being merged don't match"

assert( lhs.output.makefile.d["CXX"] == lhs.output.makefile.d["CXX"] ), "CXX compilers of the projects being merged don't match"

assert( lhs.output.makefile.d["FC"] == lhs.output.makefile.d["FC"] ), "FC compilers of the projects being merged don't match"

assert( lhs.output.makefile.d["DIM"] == lhs.output.makefile.d["DIM"] ), "dimensions of the projects being merged don't match"

assert( lhs.output.makefile.d["MODE"] == lhs.output.makefile.d["MODE"] ), "compile modes of the projects being merged don't match"

Definition at line 284 of file Project.py.

References exahype2.Project.Project._subdirectory, peano4.datamodel.Model.Model._subdirectory, peano4.Project.Project._subdirectory, api.Project.Project._subdirectory, assert, peano4.Project.Project.datamodel, peano4.Project.Project.is_extended, peano4.runner.DefaultSequence.DefaultSequence.is_extended, peano4.Project.Project.main, peano4.datamodel.DoF.DoF.namespace, peano4.datamodel.Model.Model.namespace, peano4.output.ActionSet.ActionSet.namespace, peano4.output.Jinja2TemplatedHeaderFile.Jinja2TemplatedHeaderFile.namespace, peano4.output.Jinja2TemplatedHeaderImplementationFilePair.Jinja2TemplatedHeaderImplementationFilePair.namespace, peano4.output.Observer.Observer.namespace, peano4.output.TemplatedHeaderFile.TemplatedHeaderFile.namespace, peano4.output.TemplatedHeaderImplementationFilePair.TemplatedHeaderImplementationFilePair.namespace, peano4.Project.Project.namespace, peano4.solversteps.Step.Step.namespace, kernel_impl.impl.namespace(), peano4.datamodel.Model.Model.namespaces, peano4.Project.Project.namespaces, peano4.Project.Project.output, peano4.Project.Project.rootnamespace, peano4.Project.Project.solversteps, peano4.Project.Project.subconstants, peano4.datamodel.Model.Model.subdirectories, and peano4.Project.Project.subdirectories.

Here is the call graph for this function:

◆ build()

peano4.Project.Project.build ( self,
make = True,
make_clean_first = True,
throw_away_data_after_build = False,
number_of_parallel_builds = -1 )

Invokes the underlying make build mechanism on the project.

number_of_parallel_builds: int This is mapped onto make -jnumber_of_parallel_builds, i.e., it determines how many parallel make instances the code spawns. Usually, a lot of the generated code is quite lengthy. Therefore compile time can be high. If you pass something smaller or equal to zero, it will use the core count as guideline how to compile.

throw_away_data_after_build: Bool see generate()

Definition at line 163 of file Project.py.

References peano4.Project.Project.build_was_successful, peano4.Project.Project.cleanup(), peano4.Project.Project.datamodel, peano4.Project.Project.directory, exahype2::VolumeIndex< N, Args >.generate(), exahype2::VolumeIndex< 0, Args... >.generate(), peano4.output.ActionSet.ActionSet.generate(), peano4.output.Constants.Constants.generate(), peano4.output.InvokeExternalTool.InvokeExternalTool.generate(), peano4.output.Jinja2TemplatedHeaderFile.Jinja2TemplatedHeaderFile.generate(), peano4.output.Jinja2TemplatedHeaderImplementationFilePair.Jinja2TemplatedHeaderImplementationFilePair.generate(), peano4.output.Observer.Observer.generate(), peano4.output.TemplatedHeaderFile.TemplatedHeaderFile.generate(), peano4.output.TemplatedHeaderImplementationFilePair.TemplatedHeaderImplementationFilePair.generate(), peano4.output.Makefile.Makefile.generate(), peano4.output.Output.Output.generate(), peano4.output.Constants.Constants.generate(), peano4.Project.Project.generate(), peano4.Project.Project.is_built, peano4.Project.Project.is_generated, peano4.Project.Project.output, and peano4.Project.Project.solversteps.

Referenced by peano4.Project.Project.run().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cleanup()

peano4.Project.Project.cleanup ( self)

◆ generate()

peano4.Project.Project.generate ( self,
overwrite = peano4.output.Overwrite.Default,
throw_away_data_after_generation = False )

Generate all code.

If you add stuff to your project after a build, you have to (re-)generate the code. If you compile only once, you don't have to invoke this routine explicitly. It is lazily called by the other project routines - the latest before you run the code.

It is important that I reset the output after each generate call before you change parameter settings and call generate again. To do so, invoke cleanup(). If you forget this, two subsequent generate calls enrich the output twice.

throw_away_data_after_generation: Bool The Peano 4 memory footprint can become quite substantial effectively reducing the translation capabilities (as compilers tend to require a lot of memory, too). So pass in True if you want the script to throw away the data structures (and run a garbage collection) after all files have been generated. Please note that it invalidates both this object (and maybe another object that you've used to generate the present one - such as ExaHyPE). It really strips everything down to the stuff you absolutely need to translate and run the code.

Definition at line 109 of file Project.py.

References peano4.Project.Project.constants, peano4.Project.Project.datamodel, peano4.Project.Project.directory, peano4.Project.Project.generate(), peano4.Project.Project.is_built, peano4.Project.Project.is_generated, peano4.Project.Project.main, peano4.Project.Project.output, peano4.Project.Project.project_name, peano4.Project.Project.solversteps, peano4.Project.Project.subconstants, peano4.datamodel.Model.Model.subdirectories, and peano4.Project.Project.subdirectories.

Referenced by peano4.Project.Project.build(), and peano4.Project.Project.generate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

peano4.Project.Project.run ( self,
executable,
args = [],
prefix = None,
pipefile = None,
rebuild_if_required = True )

Runs the code.

args should be a list of strings or the empty list. prefix is an array, too. A typical invocation looks alike project.run( ["16.0", "32.0"], ["/opt/mpi/mpirun", "-n", "1"] ) The operation returns True if the run had been successful

pipefile: string or None

Definition at line 238 of file Project.py.

References acoustic.Acoustic.build(), elastic.Elastic.build(), euler.Euler.build(), peano4.Project.Project.build(), peano4.Project.Project.build_was_successful, and peano4.Project.Project.is_built.

Here is the call graph for this function:

◆ set_fenv_handler()

peano4.Project.Project.set_fenv_handler ( self,
args )

Definition at line 90 of file Project.py.

References peano4.Project.Project.main.

◆ subdirectory()

Field Documentation

◆ _subdirectory

◆ build_was_successful

peano4.Project.Project.build_was_successful

Definition at line 76 of file Project.py.

Referenced by peano4.Project.Project.build(), and peano4.Project.Project.run().

◆ constants

peano4.Project.Project.constants

Definition at line 78 of file Project.py.

Referenced by peano4.Project.Project.cleanup(), and peano4.Project.Project.generate().

◆ datamodel

◆ directory

peano4.Project.Project.directory

Definition at line 49 of file Project.py.

Referenced by peano4.Project.Project.build(), and peano4.Project.Project.generate().

◆ is_built

◆ is_extended

peano4.Project.Project.is_extended

◆ is_generated

peano4.Project.Project.is_generated

◆ main

◆ namespace

◆ namespaces

peano4.Project.Project.namespaces

Definition at line 46 of file Project.py.

Referenced by peano4.Project.Project.add_subproject().

◆ output

◆ project_name

peano4.Project.Project.project_name

Definition at line 48 of file Project.py.

Referenced by peano4.Project.Project.generate().

◆ rootnamespace

peano4.Project.Project.rootnamespace

Definition at line 44 of file Project.py.

Referenced by peano4.Project.Project.add_subproject().

◆ solversteps

◆ subconstants

peano4.Project.Project.subconstants

◆ subdirectories

peano4.Project.Project.subdirectories

◆ subdirectory


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