Example #1
0
def generateGeodynBindings(x, ndim):

    dim = "Spheral::Dim< %i >" % ndim
    me = "Spheral::Geodyn%id" % ndim

    # Constructors.
    x.add_constructor([
        constrefparam("PhysicalConstants", "constants"),
        param("double",
              "minimumPressure",
              default_value="-std::numeric_limits<double>::max()"),
        param("double",
              "maximumPressure",
              default_value="std::numeric_limits<double>::max()"),
        param("MaterialPressureMinType",
              "minPressureType",
              default_value="MaterialPressureMinType::PressureFloor")
    ])

    # Generic parent interfaces.
    generateEquationOfStateVirtualBindings(x, ndim, False)
    generatePhysicsVirtualBindings(x, ndim, False)
    generateStrengthModelVirtualBindings(x, ndim, False)

    # Methods.

    # Attributes.

    return
Example #2
0
    def addConstantAccelerationMethods(self, x, ndim):

        # Object names.
        me = "Spheral::ConstantAcceleration%id" % ndim
        dim = "Spheral::Dim<%i>" % ndim
        vector = "Vector%id" % ndim
        tensor = "Tensor%id" % ndim
        symtensor = "SymTensor%id" % ndim
        fieldbase = "Spheral::FieldBase%id" % ndim
        intfield = "Spheral::IntField%id" % ndim
        scalarfield = "Spheral::ScalarField%id" % ndim
        vectorfield = "Spheral::VectorField%id" % ndim
        vector3dfield = "Spheral::Vector3dField%id" % ndim
        tensorfield = "Spheral::TensorField%id" % ndim
        thirdranktensorfield = "Spheral::ThirdRankTensorField%id" % ndim
        vectordoublefield = "Spheral::VectorDoubleField%id" % ndim
        vectorvectorfield = "Spheral::VectorVectorField%id" % ndim
        vectorsymtensorfield = "Spheral::VectorSymTensorField%id" % ndim
        symtensorfield = "Spheral::SymTensorField%id" % ndim
        intfieldlist = "Spheral::IntFieldList%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        vectorfieldlist = "Spheral::VectorFieldList%id" % ndim
        vector3dfieldlist = "Spheral::Vector3dFieldList%id" % ndim
        tensorfieldlist = "Spheral::TensorFieldList%id" % ndim
        symtensorfieldlist = "Spheral::SymTensorFieldList%id" % ndim
        thirdranktensorfieldlist = "Spheral::ThirdRankTensorFieldList%id" % ndim
        vectordoublefieldlist = "Spheral::VectorDoubleFieldList%id" % ndim
        vectorvectorfieldlist = "Spheral::VectorVectorFieldList%id" % ndim
        vectorsymtensorfieldlist = "Spheral::VectorSymTensorFieldList%id" % ndim
        nodelist = "Spheral::NodeList%id" % ndim
        state = "Spheral::State%id" % ndim
        derivatives = "Spheral::StateDerivatives%id" % ndim
        database = "Spheral::DataBase%id" % ndim
        connectivitymap = "Spheral::ConnectivityMap%id" % ndim
        key = "pair_NodeList%id_string" % ndim
        vectorkeys = "vector_of_pair_NodeList%id_string" % ndim

        # Constructors.
        x.add_constructor([
            param(vector, "a0"),
            constrefparam(nodelist, "nodeList"),
            constrefparam("vector_of_int", "indices")
        ])
        x.add_constructor(
            [param(vector, "a0"),
             constrefparam(nodelist, "nodeList")])

        # Wrap the generic physics methods.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Methods.
        const_ref_return_value(x, me, "%s::nodeList" % me, nodelist, [],
                               "nodeList")
        const_ref_return_value(x, me, "%s::flags" % me, intfield, [], "flags")

        # Attributes.
        x.add_instance_attribute("a0", vector, getter="a0", is_const=True)

        return
Example #3
0
    def generateNBodyGravityBindings(self, x, ndim):

        # Object names.
        me = "Spheral::NBodyGravity%id" % ndim
        dim = "Spheral::Dim<%i>" % ndim
        vector = "Vector%id" % ndim
        tensor = "Tensor%id" % ndim
        symtensor = "SymTensor%id" % ndim
        fieldbase = "Spheral::FieldBase%id" % ndim
        intfield = "Spheral::IntField%id" % ndim
        scalarfield = "Spheral::ScalarField%id" % ndim
        vectorfield = "Spheral::VectorField%id" % ndim
        vector3dfield = "Spheral::Vector3dField%id" % ndim
        tensorfield = "Spheral::TensorField%id" % ndim
        thirdranktensorfield = "Spheral::ThirdRankTensorField%id" % ndim
        vectordoublefield = "Spheral::VectorDoubleField%id" % ndim
        vectorvectorfield = "Spheral::VectorVectorField%id" % ndim
        vectorsymtensorfield = "Spheral::VectorSymTensorField%id" % ndim
        symtensorfield = "Spheral::SymTensorField%id" % ndim
        intfieldlist = "Spheral::IntFieldList%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        vectorfieldlist = "Spheral::VectorFieldList%id" % ndim
        vector3dfieldlist = "Spheral::Vector3dFieldList%id" % ndim
        tensorfieldlist = "Spheral::TensorFieldList%id" % ndim
        symtensorfieldlist = "Spheral::SymTensorFieldList%id" % ndim
        thirdranktensorfieldlist = "Spheral::ThirdRankTensorFieldList%id" % ndim
        vectordoublefieldlist = "Spheral::VectorDoubleFieldList%id" % ndim
        vectorvectorfieldlist = "Spheral::VectorVectorFieldList%id" % ndim
        vectorsymtensorfieldlist = "Spheral::VectorSymTensorFieldList%id" % ndim
        nodelist = "Spheral::NodeList%id" % ndim
        state = "Spheral::State%id" % ndim
        derivatives = "Spheral::StateDerivatives%id" % ndim
        database = "Spheral::DataBase%id" % ndim
        connectivitymap = "Spheral::ConnectivityMap%id" % ndim
        key = "pair_NodeList%id_string" % ndim
        vectorkeys = "vector_of_pair_NodeList%id_string" % ndim

        # Constructors.
        x.add_constructor([param("double", "plummerSofteningLength"),
                           param("double", "maxDeltaVelocity"),
                           param("double", "G"),
                           param("bool", "compatibleVelocityUpdate", default_value="false")])

        # Wrap the generic physics methods.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Methods.
        const_ref_return_value(x, me, "%s::potential" % me, scalarfieldlist, [], "potential")

        # Attributes.
        x.add_instance_attribute("G", "double", getter="G", is_const=True)
        x.add_instance_attribute("softeningLength", "double", getter="softeningLength", setter="softeningLength")
        x.add_instance_attribute("compatibleVelocityUpdate", "bool", getter="compatibleVelocityUpdate", setter="compatibleVelocityUpdate")

        return
Example #4
0
    def addLinearAccelerationMethods(self, x, ndim):

        # Object names.
        me = "LinearAcceleration%id" % ndim
        dim = "Spheral::Dim<%i>" % ndim
        vector = "Vector%id" % ndim
        tensor = "Tensor%id" % ndim
        symtensor = "SymTensor%id" % ndim
        fieldbase = "Spheral::FieldBase%id" % ndim
        intfield = "Spheral::IntField%id" % ndim
        scalarfield = "Spheral::ScalarField%id" % ndim
        vectorfield = "Spheral::VectorField%id" % ndim
        vector3dfield = "Spheral::Vector3dField%id" % ndim
        tensorfield = "Spheral::TensorField%id" % ndim
        thirdranktensorfield = "Spheral::ThirdRankTensorField%id" % ndim
        vectordoublefield = "Spheral::VectorDoubleField%id" % ndim
        vectorvectorfield = "Spheral::VectorVectorField%id" % ndim
        vectorsymtensorfield = "Spheral::VectorSymTensorField%id" % ndim
        symtensorfield = "Spheral::SymTensorField%id" % ndim
        intfieldlist = "Spheral::IntFieldList%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        vectorfieldlist = "Spheral::VectorFieldList%id" % ndim
        vector3dfieldlist = "Spheral::Vector3dFieldList%id" % ndim
        tensorfieldlist = "Spheral::TensorFieldList%id" % ndim
        symtensorfieldlist = "Spheral::SymTensorFieldList%id" % ndim
        thirdranktensorfieldlist = "Spheral::ThirdRankTensorFieldList%id" % ndim
        vectordoublefieldlist = "Spheral::VectorDoubleFieldList%id" % ndim
        vectorvectorfieldlist = "Spheral::VectorVectorFieldList%id" % ndim
        vectorsymtensorfieldlist = "Spheral::VectorSymTensorFieldList%id" % ndim
        nodelist = "Spheral::NodeList%id" % ndim
        state = "Spheral::State%id" % ndim
        derivatives = "Spheral::StateDerivatives%id" % ndim
        database = "Spheral::DataBase%id" % ndim
        connectivitymap = "Spheral::ConnectivityMap%id" % ndim
        key = "pair_NodeList%id_string" % ndim
        vectorkeys = "vector_of_pair_NodeList%id_string" % ndim

        # Constructors.
        x.add_constructor([param("double", "a0"), param("double", "aslope")])

        # Wrap the generic physics methods.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Attributes.
        x.add_instance_attribute("a0", "double", getter="a0", is_const=True)
        x.add_instance_attribute("aslope",
                                 "double",
                                 getter="aslope",
                                 is_const=True)

        return
Example #5
0
def generateStrainPorosityBindings(x, ndim):
    me = "Spheral::StrainPorosity%id" % ndim
    porouseos = "Spheral::PorousEquationOfState%id" % ndim
    porousstrength = "Spheral::PorousStrengthModel%id" % ndim
    nodelist = "Spheral::NodeList%id" % ndim
    scalarfield = "Spheral::ScalarField%id" % ndim
    vector_of_boundary = "vector_of_Boundary%id" % ndim
    fileio = "Spheral::FileIO"

    # Constructors.
    x.add_constructor([refparam(porouseos, "porousEOS"),
                       refparam(porousstrength, "porousStrength"),
                       constrefparam(nodelist, "nodeList"),
                       param("double", "phi0"),
                       param("double", "epsE"),
                       param("double", "epsX"),
                       param("double", "kappa"),
                       param("double", "gammaS0"),
                       param("double", "cS0"),
                       param("double", "c0")])

    # Physics interface.
    generatePhysicsVirtualBindings(x, ndim, False)

    # Methods.
    x.add_method("label", "std::string", [], is_const=True, is_virtual=True)
    x.add_method("dumpState", None, 
                 [refparam(fileio, "file"), refparam("std::string", "pathName")],
                 is_const=True, is_virtual=True)
    x.add_method("restoreState", None, 
                 [constrefparam(fileio, "file"), refparam("std::string", "pathName")],
                 is_virtual=True)
    
    # Attributes.
    x.add_instance_attribute("phi0", "double", getter="phi0", is_const=True)
    x.add_instance_attribute("alpha0", "double", getter="alpha0", is_const=True)
    x.add_instance_attribute("epsE", "double", getter="epsE", is_const=True)
    x.add_instance_attribute("epsX", "double", getter="epsX", is_const=True)
    x.add_instance_attribute("epsC", "double", getter="epsC", is_const=True)
    x.add_instance_attribute("kappa", "double", getter="kappa", is_const=True)
    x.add_instance_attribute("gammaS0", "double", getter="gammaS0", is_const=True)
    x.add_instance_attribute("cS0", "double", getter="cS0", is_const=True)
    x.add_instance_attribute("c0", "double", getter="c0", is_const=True)
    const_ref_return_value(x, me, "%s::porousEOS" % me, porouseos, [], "porousEOS")
    const_ref_return_value(x, me, "%s::nodeList" % me, nodelist, [], "nodeList")
    const_ref_return_value(x, me, "%s::alpha" % me, scalarfield, [], "alpha")
    const_ref_return_value(x, me, "%s::DalphaDt" % me, scalarfield, [], "DalphaDt")
    const_ref_return_value(x, me, "%s::strain" % me, scalarfield, [], "strain")
    const_ref_return_value(x, me, "%s::DstrainDt" % me, scalarfield, [], "DstrainDt")

    return
    def addMorrisMonaghanReducingViscosityMethods(self, x, ndim):

        me = "Spheral::MorrisMonaghanReducingViscosity%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        artificialviscosity = "Spheral::ArtificialViscosity%id" % ndim

        # Constructors.
        x.add_constructor([
            refparam(artificialviscosity, "q"),
            param("double", "nhQ", default_value="5.0"),
            param("double", "nhL", default_value="10.0"),
            param("double", "aMin", default_value="0.1"),
            param("double", "aMax", default_value="2.0")
        ])

        # Add the abstract methods.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Attributes
        x.add_instance_attribute("nhQ", "double", getter="nhQ", setter="nhQ")
        x.add_instance_attribute("nhL", "double", getter="nhL", setter="nhL")
        x.add_instance_attribute("aMin",
                                 "double",
                                 getter="aMin",
                                 setter="aMin")
        x.add_instance_attribute("aMax",
                                 "double",
                                 getter="aMax",
                                 setter="aMax")

        # Methods.
        const_ref_return_value(x, me, "%s::DrvAlphaDtQ" % me, scalarfieldlist,
                               [], "DrvAlphaDtQ")
        const_ref_return_value(x, me, "%s::DrvAlphaDtL" % me, scalarfieldlist,
                               [], "DrvAlphaDtL")

        return
Example #7
0
    def generateJohnsonCookDamageBindings(self, x, ndim):

        me = "Spheral::JohnsonCookDamage%id" % ndim
        dim = "Spheral::Dim<%i> " % ndim
        solidnodelist = "Spheral::SolidNodeList%id" % ndim
        vectordoublefield = "Spheral::VectorDoubleField%id" % ndim
        database = "Spheral::DataBase%id" % ndim
        state = "Spheral::State%id" % ndim
        derivatives = "Spheral::StateDerivatives%id" % ndim
        scalarfield = "Spheral::ScalarField%id" % ndim
        vectorfield = "Spheral::VectorField%id" % ndim
        symtensorfield = "Spheral::SymTensorField%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        tablekernel = "Spheral::TableKernel%id" % ndim
        fileio = "Spheral::FileIO"

        # Constructors.
        x.add_constructor([
            refparam(solidnodelist, "nodeList"),
            constrefparam(scalarfield, "D1"),
            constrefparam(scalarfield, "D2"),
            param("double", "D3"),
            param("double", "D4"),
            param("double", "D5"),
            param("double", "epsilondot0"),
            param("double", "Tcrit"),
            param("double", "sigmamax"),
            param("double", "efailmin")
        ])

        # Physics interface.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Methods.
        x.add_method(
            "applyGhostBoundaries",
            None,
            [refparam(state, "state"),
             refparam(derivatives, "derivatives")],
            is_virtual=True)
        x.add_method(
            "enforceBoundaries",
            None,
            [refparam(state, "state"),
             refparam(derivatives, "derivatives")],
            is_virtual=True)
        x.add_function_as_method(
            "const_reference_as_pointer",
            retval(ptr(solidnodelist),
                   reference_existing_object=True), [param(me, "self")],
            template_parameters=[me, solidnodelist,
                                 "&%s::nodeList" % me],
            foreign_cpp_namespace="Spheral",
            custom_name="nodeList")
        x.add_function_as_method(
            "const_reference_as_pointer",
            retval(ptr(scalarfield),
                   reference_existing_object=True), [param(me, "self")],
            template_parameters=[me, scalarfield,
                                 "&%s::failureStrain" % me],
            foreign_cpp_namespace="Spheral",
            custom_name="failureStrain")
        x.add_function_as_method("const_reference_as_pointer",
                                 retval(ptr(scalarfield),
                                        reference_existing_object=True),
                                 [param(me, "self")],
                                 template_parameters=[
                                     me, scalarfield,
                                     "&%s::meltSpecificEnergy" % me
                                 ],
                                 foreign_cpp_namespace="Spheral",
                                 custom_name="meltSpecificEnergy")
        x.add_function_as_method("const_reference_as_pointer",
                                 retval(ptr(symtensorfield),
                                        reference_existing_object=True),
                                 [param(me, "self")],
                                 template_parameters=[
                                     me, symtensorfield,
                                     "&%s::newEffectiveDamage" % me
                                 ],
                                 foreign_cpp_namespace="Spheral",
                                 custom_name="newEffectiveDamage")
        x.add_function_as_method(
            "const_reference_as_pointer",
            retval(ptr(scalarfield),
                   reference_existing_object=True), [param(me, "self")],
            template_parameters=[me, scalarfield,
                                 "&%s::D1" % me],
            foreign_cpp_namespace="Spheral",
            custom_name="D1")
        x.add_function_as_method(
            "const_reference_as_pointer",
            retval(ptr(scalarfield),
                   reference_existing_object=True), [param(me, "self")],
            template_parameters=[me, scalarfield,
                                 "&%s::D2" % me],
            foreign_cpp_namespace="Spheral",
            custom_name="D2")
        x.add_method("label",
                     "std::string", [],
                     is_const=True,
                     is_virtual=True)
        x.add_method(
            "dumpState",
            None,
            [refparam(fileio, "FileIO"),
             refparam("std::string", "pathName")],
            is_const=True,
            is_virtual=True)
        x.add_method("restoreState",
                     None, [
                         constrefparam(fileio, "FileIO"),
                         refparam("std::string", "pathName")
                     ],
                     is_virtual=True)

        # Attributes.
        x.add_instance_attribute("D3", "double", getter="D3", is_const=True)
        x.add_instance_attribute("D4", "double", getter="D4", is_const=True)
        x.add_instance_attribute("D5", "double", getter="D5", is_const=True)
        x.add_instance_attribute("epsilondot0",
                                 "double",
                                 getter="epsilondot0",
                                 is_const=True)
        x.add_instance_attribute("Tcrit",
                                 "double",
                                 getter="Tcrit",
                                 is_const=True)
        x.add_instance_attribute("sigmamax",
                                 "double",
                                 getter="sigmamax",
                                 is_const=True)
        x.add_instance_attribute("efailmin",
                                 "double",
                                 getter="efailmin",
                                 is_const=True)

        return
Example #8
0
    def generateTensorDamageModelBindings(self, x, ndim):

        me = "Spheral::TensorDamageModel%id" % ndim
        dim = "Spheral::Dim<%i> " % ndim
        solidnodelist = "Spheral::SolidNodeList%id" % ndim
        vectordoublefield = "Spheral::VectorDoubleField%id" % ndim
        database = "Spheral::DataBase%id" % ndim
        state = "Spheral::State%id" % ndim
        derivatives = "Spheral::StateDerivatives%id" % ndim
        scalarfield = "Spheral::ScalarField%id" % ndim
        vectorfield = "Spheral::VectorField%id" % ndim
        symtensorfield = "Spheral::SymTensorField%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        tablekernel = "Spheral::TableKernel%id" % ndim
        fileio = "Spheral::FileIO"

        # Constructors.
        x.add_constructor([
            refparam(solidnodelist, "nodeList"),
            param("TensorStrainAlgorithm", "strainAlgorithm"),
            param("EffectiveDamageAlgorithm", "effectiveDamageAlgorithm"),
            param("bool", "useDamageGradient"),
            constrefparam(tablekernel, "kernel"),
            param("double", "crackGrowthMultiplier"),
            param("EffectiveFlawAlgorithm", "flawAlgorithm"),
            param("double", "criticalDamageThreshold"),
            param("bool", "damageInCompression"),
            refparam(vectordoublefield, "flaws")
        ])

        # Physics interface.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Methods.
        x.add_method(
            "applyGhostBoundaries",
            None,
            [refparam(state, "state"),
             refparam(derivatives, "derivatives")],
            is_virtual=True)
        x.add_method(
            "enforceBoundaries",
            None,
            [refparam(state, "state"),
             refparam(derivatives, "derivatives")],
            is_virtual=True)
        x.add_function_as_method(
            "const_reference_as_pointer",
            retval(ptr(symtensorfield),
                   reference_existing_object=True), [param(me, "self")],
            template_parameters=[me, symtensorfield,
                                 "&%s::strain" % me],
            foreign_cpp_namespace="Spheral",
            custom_name="strain")
        x.add_function_as_method("const_reference_as_pointer",
                                 retval(ptr(symtensorfield),
                                        reference_existing_object=True),
                                 [param(me, "self")],
                                 template_parameters=[
                                     me, symtensorfield,
                                     "&%s::effectiveStrain" % me
                                 ],
                                 foreign_cpp_namespace="Spheral",
                                 custom_name="effectiveStrain")
        x.add_function_as_method(
            "const_reference_as_pointer",
            retval(ptr(scalarfield),
                   reference_existing_object=True), [param(me, "self")],
            template_parameters=[me, scalarfield,
                                 "&%s::DdamageDt" % me],
            foreign_cpp_namespace="Spheral",
            custom_name="DdamageDt")
        x.add_function_as_method("const_reference_as_pointer",
                                 retval(ptr(symtensorfield),
                                        reference_existing_object=True),
                                 [param(me, "self")],
                                 template_parameters=[
                                     me, symtensorfield,
                                     "&%s::newEffectiveDamage" % me
                                 ],
                                 foreign_cpp_namespace="Spheral",
                                 custom_name="newEffectiveDamage")
        x.add_function_as_method("const_reference_as_pointer",
                                 retval(ptr(vectorfield),
                                        reference_existing_object=True),
                                 [param(me, "self")],
                                 template_parameters=[
                                     me, vectorfield,
                                     "&%s::newDamageGradient" % me
                                 ],
                                 foreign_cpp_namespace="Spheral",
                                 custom_name="newDamageGradient")

        x.add_method("label",
                     "std::string", [],
                     is_const=True,
                     is_virtual=True)
        x.add_method(
            "dumpState",
            None,
            [refparam(fileio, "FileIO"),
             refparam("std::string", "pathName")],
            is_const=True,
            is_virtual=True)
        x.add_method("restoreState",
                     None, [
                         constrefparam(fileio, "FileIO"),
                         refparam("std::string", "pathName")
                     ],
                     is_virtual=True)

        # Attributes.
        x.add_instance_attribute("strainAlgorithm",
                                 "TensorStrainAlgorithm",
                                 getter="strainAlgorithm",
                                 is_const=True)
        x.add_instance_attribute("effectiveDamageAlgorithm",
                                 "EffectiveDamageAlgorithm",
                                 getter="effectiveDamageAlgorithm",
                                 is_const=True)
        x.add_instance_attribute("useDamageGradient",
                                 "bool",
                                 getter="useDamageGradient",
                                 setter="useDamageGradient")
        x.add_instance_attribute("damageInCompression",
                                 "bool",
                                 getter="damageInCompression",
                                 setter="damageInCompression")
        x.add_instance_attribute("criticalDamageThreshold",
                                 "double",
                                 getter="criticalDamageThreshold",
                                 setter="criticalDamageThreshold")

        return
    def addCullenDehnenViscosityMethods(self, x, ndim):

        me = "Spheral::CullenDehnenViscosity%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        artificialviscosity = "Spheral::ArtificialViscosity%id" % ndim
        tablekernel = "Spheral::TableKernel%id" % ndim
        vectorfieldlist = "Spheral::VectorFieldList%id" % ndim

        # Constructors.
        x.add_constructor([
            refparam(artificialviscosity, "q"),
            constrefparam(tablekernel, "W"),
            param("double", "alphMax", default_value="2.0"),
            param("double", "alphMin", default_value="0.02"),
            param("double", "betaC", default_value="0.7"),
            param("double", "betaD", default_value="0.05"),
            param("double", "betaE", default_value="1.0"),
            param("double", "fKern", default_value="0.33333"),
            param("bool", "boolHopkins", default_value="true")
        ])

        # Add the abstract methods.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Attributes
        x.add_instance_attribute("alphMax",
                                 "double",
                                 getter="alphMax",
                                 setter="alphMax")
        x.add_instance_attribute("alphMin",
                                 "double",
                                 getter="alphMin",
                                 setter="alphMin")
        x.add_instance_attribute("betaE",
                                 "double",
                                 getter="betaE",
                                 setter="betaE")
        x.add_instance_attribute("betaD",
                                 "double",
                                 getter="betaD",
                                 setter="betaD")
        x.add_instance_attribute("betaC",
                                 "double",
                                 getter="betaC",
                                 setter="betaC")
        x.add_instance_attribute("fKern",
                                 "double",
                                 getter="fKern",
                                 setter="fKern")
        x.add_instance_attribute("boolHopkins",
                                 "bool",
                                 getter="boolHopkins",
                                 setter="boolHopkins")

        # Methods.
        const_ref_return_value(x, me, "%s::PrevDvDt" % me, vectorfieldlist, [],
                               "PrevDvDt")
        const_ref_return_value(x, me, "%s::PrevDivV" % me, scalarfieldlist, [],
                               "PrevDivV")
        const_ref_return_value(x, me, "%s::PrevDivV2" % me, scalarfieldlist,
                               [], "PrevDivV2")
        const_ref_return_value(x, me, "%s::CullAlpha" % me, scalarfieldlist,
                               [], "CullAlpha")
        const_ref_return_value(x, me, "%s::CullAlpha2" % me, scalarfieldlist,
                               [], "CullAlpha2")
        const_ref_return_value(x, me, "%s::DalphaDt" % me, scalarfieldlist, [],
                               "DalphaDt")
        const_ref_return_value(x, me, "%s::alphaLocal" % me, scalarfieldlist,
                               [], "alphaLocal")

        return
Example #10
0
    def addPointPotentialMethods(self, x, ndim):

        # Object names.
        dim = "Spheral::Dim<%i>" % ndim
        vector = "Vector%id" % ndim
        tensor = "Tensor%id" % ndim
        symtensor = "SymTensor%id" % ndim
        fieldbase = "Spheral::FieldBase%id" % ndim
        intfield = "Spheral::IntField%id" % ndim
        scalarfield = "Spheral::ScalarField%id" % ndim
        vectorfield = "Spheral::VectorField%id" % ndim
        vector3dfield = "Spheral::Vector3dField%id" % ndim
        tensorfield = "Spheral::TensorField%id" % ndim
        thirdranktensorfield = "Spheral::ThirdRankTensorField%id" % ndim
        vectordoublefield = "Spheral::VectorDoubleField%id" % ndim
        vectorvectorfield = "Spheral::VectorVectorField%id" % ndim
        vectorsymtensorfield = "Spheral::VectorSymTensorField%id" % ndim
        symtensorfield = "Spheral::SymTensorField%id" % ndim
        intfieldlist = "Spheral::IntFieldList%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        vectorfieldlist = "Spheral::VectorFieldList%id" % ndim
        vector3dfieldlist = "Spheral::Vector3dFieldList%id" % ndim
        tensorfieldlist = "Spheral::TensorFieldList%id" % ndim
        symtensorfieldlist = "Spheral::SymTensorFieldList%id" % ndim
        thirdranktensorfieldlist = "Spheral::ThirdRankTensorFieldList%id" % ndim
        vectordoublefieldlist = "Spheral::VectorDoubleFieldList%id" % ndim
        vectorvectorfieldlist = "Spheral::VectorVectorFieldList%id" % ndim
        vectorsymtensorfieldlist = "Spheral::VectorSymTensorFieldList%id" % ndim
        nodelist = "Spheral::NodeList%id" % ndim
        state = "Spheral::State%id" % ndim
        derivatives = "Spheral::StateDerivatives%id" % ndim
        database = "Spheral::DataBase%id" % ndim
        connectivitymap = "Spheral::ConnectivityMap%id" % ndim
        key = "pair_NodeList%id_string" % ndim
        vectorkeys = "vector_of_pair_NodeList%id_string" % ndim

        # Constructors.
        x.add_constructor([
            param("double", "G"),
            param("double", "mass"),
            param("double", "coreRadius"),
            constrefparam(vector, "origin")
        ])

        # Wrap the generic physics methods.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Methods.
        x.add_method("specificPotential",
                     "double", [constrefparam(vector, "r")],
                     is_const=True)

        # Attributes.
        x.add_instance_attribute("G", "double", getter="G", setter="setG")
        x.add_instance_attribute("mass",
                                 "double",
                                 getter="mass",
                                 setter="setMass")
        x.add_instance_attribute("coreRadius",
                                 "double",
                                 getter="coreRadius",
                                 setter="setCoreRadius")
        x.add_instance_attribute("origin",
                                 vector,
                                 getter="origin",
                                 setter="setOrigin")
        x.add_instance_attribute("deltaPotentialFraction",
                                 "double",
                                 getter="deltaPotentialFraction",
                                 setter="setDeltaPotentialFraction")

        return
Example #11
0
    def generateTreeGravityBindings(self, x, me, ndim):

        # Object names.
        dim = "Spheral::Dim<%i>" % ndim
        vector = "Vector%id" % ndim
        tensor = "Tensor%id" % ndim
        symtensor = "SymTensor%id" % ndim
        fieldbase = "Spheral::FieldBase%id" % ndim
        intfield = "Spheral::IntField%id" % ndim
        scalarfield = "Spheral::ScalarField%id" % ndim
        vectorfield = "Spheral::VectorField%id" % ndim
        vector3dfield = "Spheral::Vector3dField%id" % ndim
        tensorfield = "Spheral::TensorField%id" % ndim
        thirdranktensorfield = "Spheral::ThirdRankTensorField%id" % ndim
        vectordoublefield = "Spheral::VectorDoubleField%id" % ndim
        vectorvectorfield = "Spheral::VectorVectorField%id" % ndim
        vectorsymtensorfield = "Spheral::VectorSymTensorField%id" % ndim
        symtensorfield = "Spheral::SymTensorField%id" % ndim
        intfieldlist = "Spheral::IntFieldList%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        vectorfieldlist = "Spheral::VectorFieldList%id" % ndim
        vector3dfieldlist = "Spheral::Vector3dFieldList%id" % ndim
        tensorfieldlist = "Spheral::TensorFieldList%id" % ndim
        symtensorfieldlist = "Spheral::SymTensorFieldList%id" % ndim
        thirdranktensorfieldlist = "Spheral::ThirdRankTensorFieldList%id" % ndim
        vectordoublefieldlist = "Spheral::VectorDoubleFieldList%id" % ndim
        vectorvectorfieldlist = "Spheral::VectorVectorFieldList%id" % ndim
        vectorsymtensorfieldlist = "Spheral::VectorSymTensorFieldList%id" % ndim
        nodelist = "Spheral::NodeList%id" % ndim
        state = "Spheral::State%id" % ndim
        derivatives = "Spheral::StateDerivatives%id" % ndim
        database = "Spheral::DataBase%id" % ndim
        connectivitymap = "Spheral::ConnectivityMap%id" % ndim
        key = "pair_NodeList%id_string" % ndim
        vectorkeys = "vector_of_pair_NodeList%id_string" % ndim

        # Constructors.
        x.add_constructor([param("double", "G"),
                           param("double", "softeningLength"),
                           param("double", "opening", default_value="0.5"),
                           param("double", "ftimestep", default_value="0.1"),
                           param("GravityTimeStepType", "timeStepChoice", default_value="Spheral::GravityTimeStepType::AccelerationRatio")])

        # Wrap the generic physics methods.
        generatePhysicsVirtualBindings(x, ndim, False)

        # Methods.
        x.add_method("dumpTree", "std::string", [param("bool", "globalTree")], is_const=True)
        x.add_method("dumpTreeStatistics", "std::string", [param("bool", "globalTree")], is_const=True)
        const_ref_return_value(x, me, "%s::potential" % me, scalarfieldlist, [], "potential")

        # Attributes.
        x.add_instance_attribute("G", "double", getter="G", is_const=True)
        x.add_instance_attribute("opening", "double", getter="opening", setter="opening")
        x.add_instance_attribute("softeningLength", "double", getter="softeningLength", setter="softeningLength")
        x.add_instance_attribute("ftimestep", "double", getter="ftimestep", setter="ftimestep")
        x.add_instance_attribute("timeStepChoice", "GravityTimeStepType", getter="timeStepChoice", setter="timeStepChoice")
        x.add_instance_attribute("xmin", vector, getter="xmin", is_const=True)
        x.add_instance_attribute("xmax", vector, getter="xmax", is_const=True)

        return
Example #12
0
    def generateVoronoiHourglassControlBindings(self, x, ndim):

        # Object names.
        me = "Spheral::VoronoiHourglassControl%id" % ndim
        dim = "Spheral::Dim<%i>" % ndim
        tablekernel = "Spheral::TableKernel%id" % ndim
        intfieldlist = "Spheral::IntFieldList%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        vectorfieldlist = "Spheral::VectorFieldList%id" % ndim
        vector3dfieldlist = "Spheral::Vector3dFieldList%id" % ndim
        tensorfieldlist = "Spheral::TensorFieldList%id" % ndim
        symtensorfieldlist = "Spheral::SymTensorFieldList%id" % ndim
        thirdranktensorfieldlist = "Spheral::ThirdRankTensorFieldList%id" % ndim

        # Constructors.
        x.add_constructor([
            constrefparam(tablekernel, "W"),
            param("unsigned int", "order", default_value="1"),
            param("unsigned int", "limiter", default_value="1"),
            param("double", "fraction", default_value="0.5"),
            param(intfieldlist,
                  "mask",
                  default_value=("%s(CopyFields)" % intfieldlist))
        ])

        # Methods.
        const_ref_return_value(x, me, "%s::mask" % me, intfieldlist, [],
                               "mask")
        const_ref_return_value(x, me, "%s::kernel" % me, tablekernel, [],
                               "kernel")
        const_ref_return_value(x, me, "%s::gradRho" % me, vectorfieldlist, [],
                               "gradRho")
        const_ref_return_value(x, me, "%s::A" % me, scalarfieldlist, [], "A")
        const_ref_return_value(x, me, "%s::B" % me, vectorfieldlist, [], "B")
        const_ref_return_value(x, me, "%s::C" % me, vectorfieldlist, [], "C")
        const_ref_return_value(x, me, "%s::D" % me, tensorfieldlist, [], "D")
        const_ref_return_value(x, me, "%s::gradA" % me, vectorfieldlist, [],
                               "gradA")
        const_ref_return_value(x, me, "%s::gradB" % me, tensorfieldlist, [],
                               "gradB")
        const_ref_return_value(x, me, "%s::weight" % me, scalarfieldlist, [],
                               "weight")

        # Attributes.
        x.add_instance_attribute("order",
                                 "unsigned int",
                                 getter="order",
                                 setter="order")
        x.add_instance_attribute("limiter",
                                 "unsigned int",
                                 getter="limiter",
                                 setter="limiter")
        x.add_instance_attribute("fraction",
                                 "double",
                                 getter="fraction",
                                 setter="fraction")

        # Override the abstract interface.
        generatePhysicsVirtualBindings(x, ndim, False)

        return
Example #13
0
    def generateThirdMomentHourglassControlBindings(self, x, ndim):

        # Object names.
        me = "Spheral::ThirdMomentHourglassControl%id" % ndim
        dim = "Spheral::Dim<%i>" % ndim
        vector = "Vector%id" % ndim
        tensor = "Tensor%id" % ndim
        symtensor = "SymTensor%id" % ndim
        fieldbase = "Spheral::FieldBase%id" % ndim
        intfield = "Spheral::IntField%id" % ndim
        scalarfield = "Spheral::ScalarField%id" % ndim
        vectorfield = "Spheral::VectorField%id" % ndim
        vector3dfield = "Spheral::Vector3dField%id" % ndim
        tensorfield = "Spheral::TensorField%id" % ndim
        thirdranktensorfield = "Spheral::ThirdRankTensorField%id" % ndim
        vectordoublefield = "Spheral::VectorDoubleField%id" % ndim
        vectorvectorfield = "Spheral::VectorVectorField%id" % ndim
        vectorsymtensorfield = "Spheral::VectorSymTensorField%id" % ndim
        symtensorfield = "Spheral::SymTensorField%id" % ndim
        intfieldlist = "Spheral::IntFieldList%id" % ndim
        scalarfieldlist = "Spheral::ScalarFieldList%id" % ndim
        vectorfieldlist = "Spheral::VectorFieldList%id" % ndim
        vector3dfieldlist = "Spheral::Vector3dFieldList%id" % ndim
        tensorfieldlist = "Spheral::TensorFieldList%id" % ndim
        symtensorfieldlist = "Spheral::SymTensorFieldList%id" % ndim
        thirdranktensorfieldlist = "Spheral::ThirdRankTensorFieldList%id" % ndim
        vectordoublefieldlist = "Spheral::VectorDoubleFieldList%id" % ndim
        vectorvectorfieldlist = "Spheral::VectorVectorFieldList%id" % ndim
        vectorsymtensorfieldlist = "Spheral::VectorSymTensorFieldList%id" % ndim
        nodelist = "Spheral::NodeList%id" % ndim
        state = "Spheral::State%id" % ndim
        derivatives = "Spheral::StateDerivatives%id" % ndim
        database = "Spheral::DataBase%id" % ndim
        connectivitymap = "Spheral::ConnectivityMap%id" % ndim
        key = "pair_NodeList%id_string" % ndim
        vectorkeys = "vector_of_pair_NodeList%id_string" % ndim
        tablekernel = "Spheral::TableKernel%id" % ndim
        artificialviscosity = "Spheral::ArtificialViscosity%id" % ndim
        fileio = "Spheral::FileIO"

        # Constructors.
        x.add_constructor([
            constrefparam(database, "dataBase"),
            constrefparam(tablekernel, "W"),
            param("double", "multiplier", default_value="0.05"),
            param("double", "maxAccelerationFactor", default_value="0.01")
        ])

        # Attributes.
        x.add_instance_attribute("multiplier",
                                 "double",
                                 getter="multiplier",
                                 setter="multiplier")
        x.add_instance_attribute("maxAccelerationFactor",
                                 "double",
                                 getter="maxAccelerationFactor",
                                 setter="maxAccelerationFactor")
        x.add_instance_attribute("thirdMoment",
                                 thirdranktensorfieldlist,
                                 getter="thirdMoment",
                                 is_const=True)

        # Override the abstract interface.
        generatePhysicsVirtualBindings(x, ndim, False)

        return