Peano
Loading...
Searching...
No Matches
Readme.py
Go to the documentation of this file.
1# This file is part of the Peano project. For conditions of distribution and
2# use, please see the copyright notice at www.peano-framework.org
3
4import os
5import sys
6
7from .Makefile import Makefile
8from ..Logger import Logger, LoggerPrintOption
9
10class Readme(object):
11 """
12 Creates one README for the whole setup, so people can look up what
13 they have actually built.
14
15 The README has some default content. Then it hosts some info about the
16 actual build. This information is provided from the makefile just before
17 the readme is actually dumped. Finally, there is information about the
18 individual tools used. This information is generated from
19 peano4.api.datamodel.Model where each individual model that we use adds
20 entries to the readme. Particular toolboxes or extensions can add their
21 information through their models, too
22 """
23
24 __Header = """
25# Readme of a Peano 4 project
26
27This experiment did rely on Peano 4 or a toolbox created on top of Peano.
28If you publish results obtained with this source code, we would appreciate
29if you could point to the project homepage
30
31http://www.peano-framework.org/
32
33and cite the appropriate papers from below.
34
35
36## Peano 4 ##
37
38Peano's core ideas, algorithms and (usage) vision are best discussed in the
39TOMS paper below. The TOMS paper describes the third generation of Peano.
40While it is thus not a perfect description, the core concepts by means of
41data structures and user model is the same as in Peano 4. Please cite this
42paper when you use the software:
43
44~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 @article{Weinzierl:2019:Peano,
46 author = {Weinzierl, Tobias},
47 title = {The Peano Software-Parallel, Automaton-Based, Dynamically Adaptive Grid Traversals},
48 year = {2019},
49 issue_date = {June 2019},
50 publisher = {Association for Computing Machinery},
51 address = {New York, NY, USA},
52 volume = {45},
53 number = {2},
54 issn = {0098-3500},
55 url = {https://doi.org/10.1145/3319797},
56 doi = {10.1145/3319797},
57 abstract = {We discuss the design decisions, design alternatives, and rationale behind the third generation of Peano, a framework for dynamically adaptive Cartesian meshes derived from spacetrees. Peano ties the mesh traversal to the mesh storage and supports only one element-wise traversal order resulting from space-filling curves. The user is not free to choose a traversal order herself. The traversal can exploit regular grid subregions and shared memory as well as distributed memory systems with almost no modifications to a serial application code. We formalize the software design by means of two interacting automata-one automaton for the multiscale grid traversal and one for the application-specific algorithmic steps. This yields a callback-based programming paradigm. We further sketch the supported application types and the two data storage schemes realized before we detail high-performance computing aspects and lessons learned. Special emphasis is put on observations regarding the used programming idioms and algorithmic concepts. This transforms our report from a "one way to implement things" code description into a generic discussion and summary of some alternatives, rationale, and design decisions to be made for any tree-based adaptive mesh refinement software.},
58 journal = {ACM Trans. Math. Softw.}, \
59 month = apr,
60 articleno = {14},
61 numpages = {41},
62 keywords = {Software, spacetree, adaptive mesh refinement, parallel multiscale grid traversal
63 }
64~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65
66
67There is an earlier publication about Peano in SISC which discusses the core
68algorithms with the stacks in great detail. This paper can be seen as release
69paper for previous Peano code generations (generation 2).
70
71
72~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73 @article{10.1137/100799071,
74 author = {Weinzierl, Tobias and Mehl, Miriam},
75 title = {Peano-A Traversal and Storage Scheme for Octree-Like Adaptive Cartesian Multiscale Grids},
76 year = {2011},
77 issue_date = {September 2011},
78 publisher = {Society for Industrial and Applied Mathematics},
79 address = {USA},
80 volume = {33},
81 number = {5},
82 issn = {1064-8275},
83 url = {https://doi.org/10.1137/100799071},
84 doi = {10.1137/100799071},
85 abstract = {Almost all approaches to solving partial differential equations (PDEs) are based upon a spatial discretization of the computational domain - a grid. This paper presents an algorithm to generate, store, and traverse a hierarchy of $d$-dimensional Cartesian grids represented by a $(k=3)$-spacetree, a generalization of the well-known octree concept, and it also shows the correctness of the approach. These grids may change their adaptive structure throughout the traversal. The algorithm uses $2d+4$ stacks as data structures for both cells and vertices, and the storage requirements for the pure grid reduce to one bit per vertex for both the complete grid connectivity structure and the multilevel grid relations. Since the traversal algorithm uses only stacks, the algorithm's cache hit rate is continually higher than 99.9 percent, and the runtime per vertex remains almost constant; i.e., it does not depend on the overall number of vertices or the adaptivity pattern. We use the algorithmic approach as the fundamental concept for a mesh management for $d$-dimensional PDEs and for a matrix-free PDE solver represented by a compact discrete $3^d$-point operator. In the latter case, one can implement a Jacobi smoother, a Krylov solver, or a geometric multigrid scheme within the presented traversal scheme which inherits the low memory requirements and the good memory access characteristics directly.},
86 journal = {SIAM J. Sci. Comput.},
87 month = oct,
88 pages = {2732--2760},
89 numpages = {29},
90 keywords = {octree, cache efficiency, multiscale, space-filling curve, adaptive Cartesian grid, spacetree, partial differential equation}
91 }
92~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93
94"""
95
96 def __init__(self):
97 self.bibtex_entry = []
100 self._entries = []
101 self._constants = None
102
103 def add_package_description( self, readme_package_descriptor ):
104 self._package_descriptions.add(readme_package_descriptor)
105 pass
106
107 def set_constants(self,description):
108 self._constants = description
109
110 def set_executable_name( self, executable_name ):
111 self._executable_name = executable_name
112
113 def add_entry( self, readme_entry ):
114 self._entries.append(readme_entry)
115 pass
116
117 def generate(self,directory):
118 """!
119 Write README-executablename.md into directory, e.g. README-tsunami.md
120
121 If the project has no executable name, we fall back to the name of the
122 Python script which invoked the generation.
123 """
124 name = self._executable_name or os.path.splitext(os.path.basename(sys.argv[0]))[0]
125 filename = directory + "/README-" + name + ".md"
126
127 Logger().log("Write README to {}".format(filename))
128
129 with open(filename, "w") as file:
130 file.write( self.__Header__Header )
131 file.write("""
132
133## Information provided by used packages
134
135""")
136 for i in self._package_descriptions:
137 file.write( i )
138 file.write("""
139
140## Information provided by data model
141
142""")
143 for i in self._entries:
144 file.write( i )
145 file.write( """
146
147## Summary
148
149File has been generated by
150
151python3 """)
152 for i in sys.argv:
153 file.write( " " + i )
154 file.write( """
155
156www.peano-framework.org
157(C) 2021- Tobias Weinzierl
158
159""")
160
161 Logger().log("README {} is ready".format(filename), LoggerPrintOption.ALWAYS_PRINT)
Singleton logger for the Peano 4 Python API.
Definition Logger.py:37
Creates one README for the whole setup, so people can look up what they have actually built.
Definition Readme.py:10
set_executable_name(self, executable_name)
Definition Readme.py:110
add_entry(self, readme_entry)
Definition Readme.py:113
add_package_description(self, readme_package_descriptor)
Definition Readme.py:103
set_constants(self, description)
Definition Readme.py:107
generate(self, directory)
Write README-executablename.md into directory, e.g.
Definition Readme.py:117