Commit d837db01 authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

enable mesa_pd codegen for ci

parent ff3b369b
Pipeline #24472 passed with stages
in 457 minutes and 31 seconds
......@@ -25,6 +25,8 @@ stages:
- cmake --version
- ccache --version
- mpirun --version
- python3 --version
- python3 python/mesa_pd.py -y ..
- export CCACHE_BASEDIR=$CI_PROJECT_DIR
- mkdir $CI_PROJECT_DIR/build
- cd $CI_PROJECT_DIR/build
......@@ -2073,4 +2075,4 @@ benchmark_ClangBuildAnalyzer:
- ClangBuildAnalyzer --analyze CBA
image: i10git.cs.fau.de:5005/walberla/buildenvs/clang:9.0
tags:
- docker-benchmark
\ No newline at end of file
- docker-benchmark
......@@ -11,6 +11,7 @@ import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate all necessary files for the waLBerla mesa_pd module.')
parser.add_argument('path', help='Where should the files be created?')
parser.add_argument('-y', action='store_true', help='Silent mode. Accept all questions with yes.')
args = parser.parse_args()
mpd = Module(args.path)
......@@ -120,4 +121,4 @@ if __name__ == '__main__':
mpd.add(mpi.SyncNextNeighbors(ps))
mpd.add(mpi.SyncNextNeighborsNoGhosts(ps))
mpd.generate()
mpd.generate(not args.y)
......@@ -30,21 +30,20 @@ class Module:
return component
def rename(self):
for root, dirnames, filenames in os.walk(self.context['module_path']):
for filename in filenames:
filedata = None
# print(f'renaming module name: {root}/{filename}')
with open(f'{root}/{filename}', 'r') as file:
filedata = file.read()
for filename in (f for f in self.context['module_path'].glob('**/*') if f.is_file()):
filedata = None
#print(f'renaming module name: {filename}')
with open(filename, encoding="utf-8") as fin:
filedata = fin.read()
filedata = filedata.replace('mesa_pd', self.context['name'])
filedata = filedata.replace('mesa_pd', self.context['name'])
with open(f'{root}/{filename}', 'w') as file:
file.write(filedata)
with open(filename, 'w', encoding="utf-8") as fout:
fout.write(filedata)
def generate(self, folder_check=True):
print(f"This operation will overwrite the content of: {self.context['module_path']}")
if (folder_check):
print(f"This operation will overwrite the content of: {self.context['module_path']}")
answer = input("Continue? (y to confirm)")
if (answer != "y"):
return
......@@ -52,11 +51,11 @@ class Module:
mesa_pd_folder = (Path(__file__).parents[2] / 'src' / 'mesa_pd').resolve()
if (mesa_pd_folder != self.context['module_path']):
if not self.context['module_path'].exists():
self.context['module_path'].mkdir()
self.context['module_path'].mkdir(parents=True)
shutil.rmtree(self.context['module_path'])
shutil.copytree(mesa_pd_folder, self.context['module_path'])
for d in self.components:
d.generate(self.context)
self.rename()
\ No newline at end of file
self.rename()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment