# This file was automatically generated by SWIG (https://www.swig.org).
# Version 4.1.1
#
# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.

from sys import version_info as _swig_python_version_info
# Import the low-level C/C++ module
if __package__ or "." in __name__:
    from . import _property
else:
    import _property

try:
    import builtins as __builtin__
except ImportError:
    import __builtin__

def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except __builtin__.Exception:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)


def _swig_setattr_nondynamic_instance_variable(set):
    def set_instance_attr(self, name, value):
        if name == "this":
            set(self, name, value)
        elif name == "thisown":
            self.this.own(value)
        elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add instance attributes to %s" % self)
    return set_instance_attr


def _swig_setattr_nondynamic_class_variable(set):
    def set_class_attr(cls, name, value):
        if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
            set(cls, name, value)
        else:
            raise AttributeError("You cannot add class attributes to %s" % cls)
    return set_class_attr


def _swig_add_metaclass(metaclass):
    """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
    def wrapper(cls):
        return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
    return wrapper


class _SwigNonDynamicMeta(type):
    """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
    __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)


class Property(object):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined")
    __repr__ = _swig_repr
    __swig_destroy__ = _property.delete_Property

    def name(self):
        return _property.Property_name(self)

    def classname(self):
        return _property.Property_classname(self)

    def is_computable(self, arg2):
        return _property.Property_is_computable(self, arg2)

    def cache_active(self, arg2, arg3):
        return _property.Property_cache_active(self, arg2, arg3)

    def currently_active(self, arg2):
        return _property.Property_currently_active(self, arg2)

    def cache_nonlinearity(self, arg2, arg3):
        return _property.Property_cache_nonlinearity(self, arg2, arg3)

    def currently_nonlinear(self, arg2):
        return _property.Property_currently_nonlinear(self, arg2)

    def registration(self):
        return _property.Property_registration(self)

    def c_cross_reference(self, arg2):
        return _property.Property_c_cross_reference(self, arg2)

    def c_precompute(self, arg2):
        return _property.Property_c_precompute(self, arg2)

    def c_is_symmetric_K(self, arg2):
        return _property.Property_c_is_symmetric_K(self, arg2)

    def c_is_symmetric_C(self, arg2):
        return _property.Property_c_is_symmetric_C(self, arg2)

    def c_is_symmetric_M(self, arg2):
        return _property.Property_c_is_symmetric_M(self, arg2)

    def c_constant_in_space(self):
        return _property.Property_c_constant_in_space(self)

    def c_begin_element(self, arg2, arg3):
        return _property.Property_c_begin_element(self, arg2, arg3)

    def c_end_element(self, arg2, arg3):
        return _property.Property_c_end_element(self, arg2, arg3)

    def c_post_process(self, arg2, arg3):
        return _property.Property_c_post_process(self, arg2, arg3)

    def c_output(self, arg2, arg3, arg4, arg5, arg6):
        return _property.Property_c_output(self, arg2, arg3, arg4, arg5, arg6)

# Register Property in _property:
_property.Property_swigregister(Property)
class PhysicalProperty(Property):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined")
    __repr__ = _swig_repr

    def c_integration_order(self, arg2, arg3):
        return _property.PhysicalProperty_c_integration_order(self, arg2, arg3)
    __swig_destroy__ = _property.delete_PhysicalProperty

# Register PhysicalProperty in _property:
_property.PhysicalProperty_swigregister(PhysicalProperty)
class FluxProperty(PhysicalProperty):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined")
    __repr__ = _swig_repr

    def c_flux_matrix(self, arg2, arg3, arg4, arg5, arg6, arg7, arg8):
        return _property.FluxProperty_c_flux_matrix(self, arg2, arg3, arg4, arg5, arg6, arg7, arg8)

    def c_flux_value(self, arg2, arg3, arg4, arg5, arg6, arg7):
        return _property.FluxProperty_c_flux_value(self, arg2, arg3, arg4, arg5, arg6, arg7)

    def c_static_flux_value(self, arg2, arg3, arg4, arg5, arg6, arg7):
        return _property.FluxProperty_c_static_flux_value(self, arg2, arg3, arg4, arg5, arg6, arg7)

    def c_flux_offset(self, arg2, arg3, arg4, arg5, arg6, arg7):
        return _property.FluxProperty_c_flux_offset(self, arg2, arg3, arg4, arg5, arg6, arg7)

    def c_begin_point(self, arg2, arg3, arg4, arg5):
        return _property.FluxProperty_c_begin_point(self, arg2, arg3, arg4, arg5)

    def c_end_point(self, arg2, arg3, arg4, arg5):
        return _property.FluxProperty_c_end_point(self, arg2, arg3, arg4, arg5)
    __swig_destroy__ = _property.delete_FluxProperty

# Register FluxProperty in _property:
_property.FluxProperty_swigregister(FluxProperty)
class EqnProperty(PhysicalProperty):
    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined")
    __repr__ = _swig_repr

    def c_force_deriv_matrix(self, arg2, arg3, arg4, arg5, arg6, arg7, arg8):
        return _property.EqnProperty_c_force_deriv_matrix(self, arg2, arg3, arg4, arg5, arg6, arg7, arg8)

    def c_force_value(self, arg2, arg3, arg4, arg5, arg6, arg7):
        return _property.EqnProperty_c_force_value(self, arg2, arg3, arg4, arg5, arg6, arg7)

    def c_first_time_deriv_matrix(self, arg2, arg3, arg4, arg5, arg6, arg7, arg8):
        return _property.EqnProperty_c_first_time_deriv_matrix(self, arg2, arg3, arg4, arg5, arg6, arg7, arg8)

    def c_second_time_deriv_matrix(self, arg2, arg3, arg4, arg5, arg6, arg7, arg8):
        return _property.EqnProperty_c_second_time_deriv_matrix(self, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
    __swig_destroy__ = _property.delete_EqnProperty

# Register EqnProperty in _property:
_property.EqnProperty_swigregister(EqnProperty)
# -*- python -*-

# This software was produced by NIST, an agency of the U.S. government,
# and by statute is not subject to copyright in the United States.
# Recipients of this software assume all responsibilities associated
# with its operation, modification and maintenance. However, to
# facilitate maintenance we ask that before distributing modified
# versions of this software, you first contact the authors at
# oof_manager@nist.gov. 

from ooflib.common import debug

# Add class data to the Property class.  The "registry" data member
# is used by the Registration class to muck about with parameters and
# so forth.

Property.registry = []

def _Property___eq__(self, other):
    if isinstance(other, Property) and other.this == self.this:
        return 1
    return 0

Property.__eq__ = _Property___eq__

#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

# Property.bookkeeping is called by Material.cross_reference

def _Property_bookkeeping(self, material):
    material.registerPropertyType(self, self.registration().propertyType())
    for field in self.registration().fields():
        field.registerProperty(self)
    for flux in self.registration().fluxes():
        material.registerFlux(self, flux)
    for eqn in self.registration().equations():
        material.registerEqn(self, eqn)
    for propertyoutput in self.registration().outputs():
        material.registerOutput(self, propertyoutput)

Property.bookkeeping = _Property_bookkeeping

#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

def _Property_is_active(self, subproblem):
# If this property has time_deriv_fields, and the stepper is
# static, then the property isn't active.
    eqns = subproblem.all_equations()
    if (eqns and subproblem.staticStepper()
        and self.registration().time_deriv_fields(*eqns)):
        return False

    if self.is_computable(subproblem):
        pfluxes = self.registration().fluxes()
        peqns = self.registration().equations()
# If the Property has no fluxes or equations, it must be used
# by other Properties, so call it active.
        if not pfluxes and not peqns:
            return True
        for flux in pfluxes:
            if subproblem.is_active_flux(flux):
                return True
        for eqn in peqns:
            if subproblem.is_active_equation(eqn):
                return True
    return False

Property.is_active = _Property_is_active

#=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=##=--=#

# Is the Property nonlinear in the given fields? 

def _Property_is_nonlinear(self, fields):
    return self.registration().nonlinear(fields)

Property.is_nonlinear = _Property_is_nonlinear


cvar = _property.cvar

