# Path: openmodes/helpers.py
# class Identified(object):
#     """An object which can be uniquely identified by an id number. It is
#     assumed that any object which subclasses Identified is immutable, so that
#     its id can be used for caching complex results which depend on this object.
#     """
# 
#     def __init__(self):
#         self.id = uuid.uuid4()
# 
#     def __hash__(self):
#         return self.id.__hash__()
# 
#     def __eq__(self, other):
#         return hasattr(other, 'id') and (self.id == other.id)
# 
#     def __repr__(self):
#         "Represent the object by its id, in addition to its memory address"
#         return ("<%s at 0x%08x with id %s>" % (str(self.__class__)[8:-2],
#                                                id(self),
#                                                str(self.id)))
# 
# def wrap_if_constant(func):
#     """If passed a constant, wrap it in a function. If passed a function, just
#     return it as is"""
#     if hasattr(func, '__call__'):
#         return func
#     else:
#         return lambda x: func
# 
# Path: openmodes/constants.py



import numpy as np
from openmodes.helpers import Identified, wrap_if_constant
from openmodes.constants import eta_0
#-----------------------------------------------------------------------------
#  OpenModes - An eigenmode solver for open electromagnetic resonantors
#  Copyright (C) 2013 David Powell
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#-----------------------------------------------------------------------------
"""
Routines to describe materials
"""
from __future__ import division




class IsotropicMaterial(Identified):
    "An isotropic material with a given permittivity and permeability"
    def __init__(self, name, epsilon_r, mu_r):
        super(IsotropicMaterial, self).__init__()
        self.name = name

# Path: openmodes/helpers.py
# class Identified(object):
#     """An object which can be uniquely identified by an id number. It is
#     assumed that any object which subclasses Identified is immutable, so that
#     its id can be used for caching complex results which depend on this object.
#     """
# 
#     def __init__(self):
#         self.id = uuid.uuid4()
# 
#     def __hash__(self):
#         return self.id.__hash__()
# 
#     def __eq__(self, other):
#         return hasattr(other, 'id') and (self.id == other.id)
# 
#     def __repr__(self):
#         "Represent the object by its id, in addition to its memory address"
#         return ("<%s at 0x%08x with id %s>" % (str(self.__class__)[8:-2],
#                                                id(self),
#                                                str(self.id)))
# 
# def wrap_if_constant(func):
#     """If passed a constant, wrap it in a function. If passed a function, just
#     return it as is"""
#     if hasattr(func, '__call__'):
#         return func
#     else:
#         return lambda x: func
# 
# Path: openmodes/constants.py



# Path: openmodes/material.py
import numpy as np
from openmodes.helpers import Identified, wrap_if_constant
from openmodes.constants import eta_0

#-----------------------------------------------------------------------------
#  OpenModes - An eigenmode solver for open electromagnetic resonantors
#  Copyright (C) 2013 David Powell
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.
#-----------------------------------------------------------------------------
"""
Routines to describe materials
"""
from __future__ import division




class IsotropicMaterial(Identified):
    "An isotropic material with a given permittivity and permeability"
    def __init__(self, name, epsilon_r, mu_r):
        super(IsotropicMaterial, self).__init__()
        self.name = name

        self.epsilon_r = wrap_if_constant(epsilon_r)