Example #1
0
class ExplicitEuler:
    def __init__(self):
        self.accessor = Accessor()
        self.accessor.require("position",
                              "walberla::mesa_pd::Vec3",
                              access="gs")
        self.accessor.require("linearVelocity",
                              "walberla::mesa_pd::Vec3",
                              access="gs")
        self.accessor.require("invMass", "walberla::real_t", access="g")
        self.accessor.require("force", "walberla::mesa_pd::Vec3", access="gs")
        self.accessor.require("flags",
                              "walberla::mesa_pd::data::particle_flags::FlagT",
                              access="g")

    def getRequirements(self):
        return self.accessor

    def generate(self, path):
        context = dict()
        context["interface"] = self.accessor.properties
        generateFile(path, 'kernel/ExplicitEuler.templ.h', context)

        context["InterfaceTestName"] = "ExplicitEulerInterfaceCheck"
        context["KernelInclude"] = "kernel/ExplicitEuler.h"
        context[
            "ExplicitInstantiation"] = "template void kernel::ExplicitEuler::operator()(const size_t p_idx1, Accessor& ac) const;"
        generateFile(
            path, 'tests/CheckInterface.templ.cpp', context,
            '../../tests/mesa_pd/kernel/interfaces/ExplicitEulerInterfaceCheck.cpp'
        )
Example #2
0
class ClearNextNeighborSync:
   def __init__(self):
      self.accessor = Accessor()
      self.accessor.require("flags",        "walberla::mesa_pd::data::particle_flags::FlagT", access="g")
      self.accessor.require("ghostOwners",  "std::vector<int>",                           access="r")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["interface"] = self.accessor.properties
      generateFile(path, 'mpi/ClearNextNeighborSync.templ.h', context)
Example #3
0
class SingleCast:
    def __init__(self, shapes):
        self.shapes = shapes
        self.accessor = Accessor()
        self.accessor.require("shape", "BaseShape*", access="g")

    def getRequirements(self):
        return self.accessor

    def generate(self, path):
        context = dict()
        context["interface"] = self.accessor.properties
        context["shapes"] = self.shapes
        generateFile(path, 'kernel/SingleCast.templ.h', context)
Example #4
0
class DoubleCast:
   def __init__(self, shapes):
      self.shapes = shapes
      self.accessor = Accessor()
      self.accessor.require("shape", "BaseShape*", access="g")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["interface"] = self.accessor.properties
      context["shapes"]    = self.shapes
      generateFile(path, 'kernel/DoubleCast.templ.h', context)
class ClearNextNeighborSync:
    def __init__(self):
        self.accessor = Accessor()
        self.accessor.require("flags",
                              "walberla::mesa_pd::data::particle_flags::FlagT",
                              access="g")
        self.accessor.require("ghostOwners", "std::vector<int>", access="r")

    def getRequirements(self):
        return self.accessor

    def generate(self, path):
        context = dict()
        context["interface"] = self.accessor.properties
        generateFile(path, 'mpi/ClearNextNeighborSync.templ.h', context)
class TemperatureIntegration:
   def __init__(self):
      self.accessor = Accessor()
      self.accessor.require("temperature",     "walberla::real_t", access="gs")
      self.accessor.require("heatFlux",        "walberla::real_t", access="gs")
      self.accessor.require("type",            "uint_t",           access="g")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["parameters"]       = ["invHeatCapacity"]
      context["interface"] = self.accessor.properties
      generateFile(path, 'kernel/TemperatureIntegration.templ.h', context)

      context["InterfaceTestName"] = "TemperatureIntegrationInterfaceCheck"
      context["KernelInclude"] = "kernel/TemperatureIntegration.h"
      context["ExplicitInstantiation"] = "template void kernel::TemperatureIntegration::operator()(const size_t p_idx1, Accessor& ac) const;"
      generateFile(path, 'tests/CheckInterface.templ.cpp', context, '../../tests/mesa_pd/kernel/interfaces/TemperatureIntegrationInterfaceCheck.cpp')
Example #7
0
class ForceLJ:
    def __init__(self):
        self.accessor = Accessor()
        self.accessor.require("position",
                              "walberla::mesa_pd::Vec3",
                              access="g")
        self.accessor.require("force", "walberla::mesa_pd::Vec3", access="r")
        self.accessor.require("type", "uint_t", access="g")

    def getRequirements(self):
        return self.accessor

    def generate(self, path):
        context = dict()
        context["parameters"] = ["epsilon", "sigma"]
        context["interface"] = self.accessor.properties

        generateFile(path, 'kernel/ForceLJ.templ.h', context)

        context["InterfaceTestName"] = "ForceLJInterfaceCheck"
        context["KernelInclude"] = "kernel/ForceLJ.h"
        context[
            "ExplicitInstantiation"] = "template void kernel::ForceLJ::operator()(const size_t p_idx1, const size_t p_idx2, Accessor& ac) const;"
        generateFile(
            path, 'tests/CheckInterface.templ.cpp', context,
            '../../tests/mesa_pd/kernel/interfaces/ForceLJInterfaceCheck.cpp')
Example #8
0
class DetectAndStoreContacts:
    def __init__(self):
        self.accessor = Accessor()
        self.accessor.require("uid", "walberla::id_t", access="g")
        self.accessor.require("flags",
                              "walberla::mesa_pd::data::particle_flags::FlagT",
                              access="g")
        self.accessor.require("position",
                              "walberla::mesa_pd::Vec3",
                              access="g")
        self.accessor.require("rotation",
                              "walberla::mesa_pd::Rot3",
                              access="g")
        self.accessor.require("shape", "BaseShape*", access="g")

    def getRequirements(self):
        return self.accessor

    def generate(self, path):
        context = dict()
        context["interface"] = self.accessor.properties
        generateFile(path, 'kernel/DetectAndStoreContacts.templ.h', context)
Example #9
0
class ExplicitEuler:
   def __init__(self):
      self.accessor = Accessor()
      self.accessor.require("position",        "walberla::mesa_pd::Vec3", access="gs")
      self.accessor.require("linearVelocity",  "walberla::mesa_pd::Vec3", access="gs")
      self.accessor.require("invMass",         "walberla::real_t",        access="g" )
      self.accessor.require("force",           "walberla::mesa_pd::Vec3", access="gs" )
      self.accessor.require("flags",           "walberla::mesa_pd::data::particle_flags::FlagT", access="g")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["interface"] = self.accessor.properties
      generateFile(path, 'kernel/ExplicitEuler.templ.h', context)

      context["InterfaceTestName"] = "ExplicitEulerInterfaceCheck"
      context["KernelInclude"] = "kernel/ExplicitEuler.h"
      context["ExplicitInstantiation"] = "template void kernel::ExplicitEuler::operator()(const size_t p_idx1, Accessor& ac) const;"
      generateFile(path, 'tests/CheckInterface.templ.cpp', context, '../../tests/mesa_pd/kernel/interfaces/ExplicitEulerInterfaceCheck.cpp')
Example #10
0
class InsertParticleIntoLinkedCells:
    def __init__(self):
        self.accessor = Accessor()
        self.accessor.require("position",
                              "walberla::mesa_pd::Vec3",
                              access="g")
        self.accessor.require("flags",
                              "walberla::mesa_pd::data::particle_flags::FlagT",
                              access="g")
        self.accessor.require("nextParticle", "size_t", access="gs")

    def getRequirements(self):
        return self.accessor

    def generate(self, path):
        context = dict()
        context["interface"] = self.accessor.properties
        generateFile(path, 'kernel/InsertParticleIntoLinkedCells.templ.h',
                     context)
Example #11
0
class HeatConduction:
   def __init__(self):
      self.accessor = Accessor()
      self.accessor.require("temperature",     "walberla::real_t", access="g")
      self.accessor.require("heatFlux",        "walberla::real_t", access="gsr")
      self.accessor.require("type",            "uint_t",           access="g")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["parameters"]       = ["conductance"]
      context["interface"]        = self.accessor.properties

      generateFile(path, 'kernel/HeatConduction.templ.h', context)

      context["InterfaceTestName"] = "HeatConductionInterfaceCheck"
      context["KernelInclude"] = "kernel/HeatConduction.h"
      context["ExplicitInstantiation"] = "template void kernel::HeatConduction::operator()(const size_t p_idx1, const size_t p_idx2, Accessor& ac) const;"
      generateFile(path, 'tests/CheckInterface.templ.cpp', context, '../../tests/mesa_pd/kernel/interfaces/HeatConductionInterfaceCheck.cpp')
Example #12
0
class ForceLJ:
   def __init__(self):
      self.accessor = Accessor()
      self.accessor.require("position",        "walberla::mesa_pd::Vec3", access="g")
      self.accessor.require("force",           "walberla::mesa_pd::Vec3", access="r" )
      self.accessor.require("type",            "uint_t",              access="g")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["parameters"]       = ["epsilon", "sigma"]
      context["interface"]        = self.accessor.properties

      generateFile(path, 'kernel/ForceLJ.templ.h', context)

      context["InterfaceTestName"] = "ForceLJInterfaceCheck"
      context["KernelInclude"] = "kernel/ForceLJ.h"
      context["ExplicitInstantiation"] = "template void kernel::ForceLJ::operator()(const size_t p_idx1, const size_t p_idx2, Accessor& ac) const;"
      generateFile(path, 'tests/CheckInterface.templ.cpp', context, '../../tests/mesa_pd/kernel/interfaces/ForceLJInterfaceCheck.cpp')
class VelocityVerletWithShape:
   def __init__(self):
      self.accessor = Accessor()
      self.accessor.require("position",        "walberla::mesa_pd::Vec3", access="gs")
      self.accessor.require("linearVelocity",  "walberla::mesa_pd::Vec3", access="gs")
      self.accessor.require("invMass",         "walberla::real_t",        access="g" )
      self.accessor.require("force",           "walberla::mesa_pd::Vec3", access="gs" )
      self.accessor.require("oldForce",        "walberla::mesa_pd::Vec3", access="gs" )

      self.accessor.require("rotation",        "walberla::mesa_pd::Rot3", access="gs")
      self.accessor.require("angularVelocity", "walberla::mesa_pd::Vec3", access="gs")
      self.accessor.require("invInertiaBF",    "walberla::mesa_pd::Mat3", access="g" )
      self.accessor.require("torque",          "walberla::mesa_pd::Vec3", access="gs" )
      self.accessor.require("oldTorque",       "walberla::mesa_pd::Vec3", access="gs" )

      self.accessor.require("flags",           "walberla::mesa_pd::data::particle_flags::FlagT", access="g")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["interface"] = self.accessor.properties

      generateFile(path, 'kernel/VelocityVerletWithShape.templ.h', context)

      context["InterfaceTestName"] = "VelocityVerletWithShapeInterfaceCheck"
      context["KernelInclude"] = "kernel/VelocityVerletWithShape.h"
      context["ExplicitInstantiation"] = "template void kernel::VelocityVerletWithShapePreForceUpdate::operator()(const size_t p_idx1, Accessor& ac) const;\n" +\
      "template void kernel::VelocityVerletWithShapePostForceUpdate::operator()(const size_t p_idx1, Accessor& ac) const;"
      generateFile(path, 'tests/CheckInterface.templ.cpp', context, '../../tests/mesa_pd/kernel/interfaces/VelocityVerletWithShapeInterfaceCheck.cpp')
Example #14
0
class LinearSpringDashpot:
    def __init__(self):
        self.accessor = Accessor()
        self.accessor.require("uid", "walberla::id_t", access="g")
        self.accessor.require("position",
                              "walberla::mesa_pd::Vec3",
                              access="g")
        self.accessor.require("linearVelocity",
                              "walberla::mesa_pd::Vec3",
                              access="g")
        self.accessor.require("force", "walberla::mesa_pd::Vec3", access="r")
        self.accessor.require("angularVelocity",
                              "walberla::mesa_pd::Vec3",
                              access="g")
        self.accessor.require("torque", "walberla::mesa_pd::Vec3", access="r")
        self.accessor.require("type", "uint_t", access="g")
        self.accessor.require(
            "contactHistory",
            "std::map<walberla::id_t, walberla::mesa_pd::Vec3>",
            access="gs")

    def getRequirements(self):
        return self.accessor

    def generate(self, path):
        context = dict()
        context["parameters"] = [
            "stiffnessN", "stiffnessT", "dampingN", "dampingT",
            "frictionCoefficientStatic", "frictionCoefficientDynamic"
        ]
        context["interface"] = self.accessor.properties

        generateFile(path, 'kernel/LinearSpringDashpot.templ.h', context)
Example #15
0
class VelocityVerletWithShape:
    def __init__(self):
        self.accessor = Accessor()
        self.accessor.require("position",
                              "walberla::mesa_pd::Vec3",
                              access="gs")
        self.accessor.require("linearVelocity",
                              "walberla::mesa_pd::Vec3",
                              access="gs")
        self.accessor.require("invMass", "walberla::real_t", access="g")
        self.accessor.require("force", "walberla::mesa_pd::Vec3", access="gs")
        self.accessor.require("oldForce",
                              "walberla::mesa_pd::Vec3",
                              access="gs")

        self.accessor.require("rotation",
                              "walberla::mesa_pd::Rot3",
                              access="gs")
        self.accessor.require("angularVelocity",
                              "walberla::mesa_pd::Vec3",
                              access="gs")
        self.accessor.require("invInertiaBF",
                              "walberla::mesa_pd::Mat3",
                              access="g")
        self.accessor.require("torque", "walberla::mesa_pd::Vec3", access="gs")
        self.accessor.require("oldTorque",
                              "walberla::mesa_pd::Vec3",
                              access="gs")

        self.accessor.require("flags",
                              "walberla::mesa_pd::data::particle_flags::FlagT",
                              access="g")

    def getRequirements(self):
        return self.accessor

    def generate(self, path):
        context = dict()
        context["interface"] = self.accessor.properties

        generateFile(path, 'kernel/VelocityVerletWithShape.templ.h', context)

        context["InterfaceTestName"] = "VelocityVerletWithShapeInterfaceCheck"
        context["KernelInclude"] = "kernel/VelocityVerletWithShape.h"
        context["ExplicitInstantiation"] = "template void kernel::VelocityVerletWithShapePreForceUpdate::operator()(const size_t p_idx1, Accessor& ac) const;\n" +\
        "template void kernel::VelocityVerletWithShapePostForceUpdate::operator()(const size_t p_idx1, Accessor& ac) const;"
        generateFile(
            path, 'tests/CheckInterface.templ.cpp', context,
            '../../tests/mesa_pd/kernel/interfaces/VelocityVerletWithShapeInterfaceCheck.cpp'
        )
Example #16
0
class NonLinearSpringDashpot:
   def __init__(self):
      self.accessor = Accessor()
      self.accessor.require("uid",             "walberla::id_t",                                access="g")
      self.accessor.require("position",        "walberla::mesa_pd::Vec3",                           access="g")
      self.accessor.require("linearVelocity",  "walberla::mesa_pd::Vec3",                           access="g")
      self.accessor.require("force",           "walberla::mesa_pd::Vec3",                           access="r" )
      self.accessor.require("angularVelocity", "walberla::mesa_pd::Vec3",                           access="g")
      self.accessor.require("torque",          "walberla::mesa_pd::Vec3",                           access="r" )
      self.accessor.require("type",            "uint_t",                                        access="g")
      self.accessor.require("contactHistory",  "std::map<walberla::id_t, walberla::mesa_pd::Vec3>", access="gs")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["parameters"]       = ["lnCORsqr", "meff", "stiffnessT", "dampingT", "frictionCoefficientStatic", "frictionCoefficientDynamic"]
      context["interface"]        = self.accessor.properties

      generateFile(path, 'kernel/NonLinearSpringDashpot.templ.h', context)
Example #17
0
class SpringDashpot:
   def __init__(self):
      self.accessor = Accessor()
      self.accessor.require("position",        "walberla::mesa_pd::Vec3",                           access="g")
      self.accessor.require("linearVelocity",  "walberla::mesa_pd::Vec3",                           access="g")
      self.accessor.require("force",           "walberla::mesa_pd::Vec3",                           access="r" )
      self.accessor.require("angularVelocity", "walberla::mesa_pd::Vec3",                           access="g")
      self.accessor.require("torque",          "walberla::mesa_pd::Vec3",                           access="r" )
      self.accessor.require("type",            "uint_t",                                            access="g")
      self.accessor.require("contactHistory",  "std::map<walberla::id_t, walberla::mesa_pd::Vec3>", access="gs")

   def getRequirements(self):
      return self.accessor

   def generate(self, path):
      context = dict()
      context["parameters"]       = ["stiffness", "dampingN", "dampingT", "friction"]
      context["interface"]        = self.accessor.properties

      generateFile(path, 'kernel/SpringDashpot.templ.h', context)

      context["InterfaceTestName"] = "SpringDashpotInterfaceCheck"
      context["KernelInclude"] = "kernel/SpringDashpot.h"
      context["ExplicitInstantiation"] = "template void kernel::SpringDashpot::operator()(const size_t p_idx1, const size_t p_idx2, Accessor& ac, const Vec3& contactPoint, const Vec3& contactNormal, const real_t& penetrationDepth) const;"
      generateFile(path, 'tests/CheckInterface.templ.cpp', context, '../../tests/mesa_pd/kernel/interfaces/SpringDashpotInterfaceCheck.cpp')