Commit 88e758e8 authored by Sebastian Eibl's avatar Sebastian Eibl

updated generation scripts for new interface

parent d3b385c5
Pipeline #22567 passed with stages
in 556 minutes and 53 seconds
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from mesa_pd.accessor import Accessor
from mesa_pd import Module
import mesa_pd.data as data
import mesa_pd.kernel as kernel
import mesa_pd.mpi as mpi
import argparse
import numpy as np
import os
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("-f", "--force", help="Generate the files even if not inside a waLBerla directory.",
action="store_true")
args = parser.parse_args()
if ((not os.path.isfile(args.path + "/src/walberla.h")) and (not args.force)):
raise RuntimeError(args.path + " is not the path to a waLBerla root directory! Specify -f to generate the files anyway.")
os.makedirs(args.path + "/src/mesa_pd/common", exist_ok = True)
os.makedirs(args.path + "/src/mesa_pd/data", exist_ok = True)
os.makedirs(args.path + "/src/mesa_pd/domain", exist_ok = True)
os.makedirs(args.path + "/src/mesa_pd/kernel", exist_ok = True)
os.makedirs(args.path + "/src/mesa_pd/mpi/notifications", exist_ok = True)
os.makedirs(args.path + "/src/mesa_pd/vtk", exist_ok = True)
shapes = ["Sphere", "HalfSpace"]
ps = data.ParticleStorage()
ch = data.ContactHistory()
lc = data.LinkedCells()
ss = data.ShapeStorage(ps, shapes)
ps.addProperty("position", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS")
ps.addProperty("linearVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS")
ps.addProperty("invMass", "walberla::real_t", defValue="real_t(1)", syncMode="ON_GHOST_CREATION")
ps.addProperty("force", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER")
ps.addProperty("shapeID", "size_t", defValue="", syncMode="ON_GHOST_CREATION")
ps.addProperty("rotation", "walberla::mesa_pd::Rot3", defValue="", syncMode="ALWAYS")
ps.addProperty("angularVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS")
ps.addProperty("torque", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER")
ps.addProperty("type", "uint_t", defValue="0", syncMode="ON_GHOST_CREATION")
ps.addProperty("flags", "walberla::mesa_pd::data::particle_flags::FlagT", defValue="", syncMode="ON_GHOST_CREATION")
ps.addProperty("nextParticle", "int", defValue="-1", syncMode="NEVER")
ps.addInclude("blockforest/BlockForest.h")
ps.addProperty("currentBlock", "blockforest::BlockID", defValue="", syncMode="NEVER")
kernels = []
kernels.append( kernel.DoubleCast(shapes) )
kernels.append( kernel.ExplicitEuler() )
kernels.append( kernel.ExplicitEulerWithShape() )
kernels.append( kernel.ForceLJ() )
kernels.append( kernel.HeatConduction() )
kernels.append( kernel.InsertParticleIntoLinkedCells() )
kernels.append( kernel.LinearSpringDashpot() )
kernels.append( kernel.NonLinearSpringDashpot() )
kernels.append( kernel.SingleCast(shapes) )
kernels.append( kernel.SpringDashpot() )
kernels.append( kernel.TemperatureIntegration() )
kernels.append( kernel.VelocityVerlet() )
kernels.append( kernel.VelocityVerletWithShape() )
ac = Accessor()
for k in kernels:
ac.mergeRequirements(k.getRequirements())
ac.printSummary()
comm = []
comm.append(mpi.BroadcastProperty())
comm.append(mpi.ClearNextNeighborSync())
comm.append(mpi.ReduceContactHistory())
comm.append(mpi.ReduceProperty())
comm.append(mpi.SyncGhostOwners(ps))
comm.append(mpi.SyncNextNeighbors(ps))
ps.generate(args.path + "/src/mesa_pd/")
ch.generate(args.path + "/src/mesa_pd/")
lc.generate(args.path + "/src/mesa_pd/")
ss.generate(args.path + "/src/mesa_pd/")
for k in kernels:
k.generate(args.path + "/src/mesa_pd/")
for c in comm:
c.generate(args.path + "/src/mesa_pd/")
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?')
args = parser.parse_args()
mpd = Module(args.path)
ps = mpd.add(data.ParticleStorage())
ps.set_shapes("Sphere", "HalfSpace")
ps.add_property("position", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS")
ps.add_property("linearVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS")
ps.add_property("invMass", "walberla::real_t", defValue="real_t(1)", syncMode="ON_GHOST_CREATION")
ps.add_property("force", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER")
ps.add_property("shapeID", "size_t", defValue="", syncMode="ON_GHOST_CREATION")
ps.add_property("rotation", "walberla::mesa_pd::Rot3", defValue="", syncMode="ALWAYS")
ps.add_property("angularVelocity", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="ALWAYS")
ps.add_property("torque", "walberla::mesa_pd::Vec3", defValue="real_t(0)", syncMode="NEVER")
ps.add_property("type", "uint_t", defValue="0", syncMode="ON_GHOST_CREATION")
ps.add_property("flags", "walberla::mesa_pd::data::particle_flags::FlagT", defValue="", syncMode="ON_GHOST_CREATION")
ps.add_property("nextParticle", "int", defValue="-1", syncMode="NEVER")
ps.add_include("blockforest/BlockForest.h")
ps.add_property("currentBlock", "blockforest::BlockID", defValue="", syncMode="NEVER")
mpd.add(data.LinkedCells())
mpd.add(data.SparseLinkedCells())
mpd.add(data.ShapeStorage(ps))
mpd.add(kernel.DoubleCast(ps))
mpd.add(kernel.ExplicitEuler())
mpd.add(kernel.ExplicitEulerWithShape())
mpd.add(kernel.ForceLJ())
mpd.add(kernel.HeatConduction())
mpd.add(kernel.InsertParticleIntoLinkedCells())
mpd.add(kernel.LinearSpringDashpot())
mpd.add(kernel.NonLinearSpringDashpot())
mpd.add(kernel.SingleCast(ps))
mpd.add(kernel.SpringDashpot())
mpd.add(kernel.TemperatureIntegration())
mpd.add(kernel.VelocityVerlet())
mpd.add(kernel.VelocityVerletWithShape())
mpd.add(mpi.BroadcastProperty())
mpd.add(mpi.ClearGhostOwnerSync())
mpd.add(mpi.ClearNextNeighborSync())
mpd.add(mpi.Notifications(ps))
ftn = mpd.add(mpi.PropertyNotification('ForceTorqueNotification'))
ftn.add_property('force', 'mesa_pd::Vec3', 'Vec3(real_t(0))')
ftn.add_property('torque', 'mesa_pd::Vec3', 'Vec3(real_t(0))')
mpd.add(mpi.ReduceContactHistory())
mpd.add(mpi.ReduceProperty())
mpd.add(mpi.ShapePackUnpack(ps))
mpd.add(mpi.SyncGhostOwners(ps))
mpd.add(mpi.SyncNextNeighbors(ps))
mpd.add(mpi.SyncNextNeighborsNoGhosts(ps))
mpd.generate()
......@@ -7,8 +7,6 @@ import mesa_pd.kernel as kernel
import mesa_pd.mpi as mpi
import argparse
import numpy as np
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Generate all necessary files for the waLBerla mesa_pd module.')
......
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