示例#1
0
    def __init__(self,**kwargs):
        """
        
        Parameters
        ----------

        'NumberOfTimestepsrTs' : 1e9,
        'endCriteria': 1e-5,
        'MaxTime': 0 ,
        'OverSampling': 0,
        'CoordSystem':0,
        'MultiGrid':0,
        'f_max' : 

        """

        Element.__init__(self,'FDTD')
        d = {}
        for k in kwargs:
            if type(kwargs[k])!=str:
                d[k]=str(kwargs[k])
            else:
                d[k]=kwargs[k]

        self.attrib.update(d)
示例#2
0
    def __init__(self, Name='port_ut1', Type='wv', Weight='1'):
        """

type:     0 for voltage probing => 'vp'
          1 for current probing => 'cp'
          2 for E-field probing => 'Efp'
          3 for H-field probing => 'Hfp'
          10 for waveguide voltage mode matching => 'wv'
         11 for waveguide current mode matching => 'wc'

"""
        Element.__init__(self,'ProbeBox')
        self.attrib['Weight']=Weight
        if Type=='vp':
            self.attrib['Type']='0'
        if Type=='cp':
            self.attrib['Type']='1'
        if Type=='Efp':
            self.attrib['Type']='2'
        if Type=='Hfp':
            self.attrib['Type']='3'
        if Type=='wv':
            self.attrib['Type']='10'
        if Type=='wc':
            self.attrib['Type']='11'
        self.append(Attributes('Attributes',a))
示例#3
0
    def __init__(self,Name,typ='Me',**kwargs):

        dtyp={'Me':'Metal',
              'Ma':'Material',
              'Cs':'ConductingSheet'
             }

        Element.__init__(self,dtyp[typ],Name=Name)
        Prim = Element('Primitives')
        self.append(Prim)


        if typ!='Me':
            if typ=='Cs':
                if 'thickness' not in kwargs:
                    raise NameError('Conducting Sheet must have a thickness')
                if 'conductivity' not in kwargs:
                    raise NameError('Conducting Sheet must have a conductivity')

                assert (eval(kwargs['conductivity'])>1e6), "conductivity below 1MA/Vm is not recommended"
                assert (eval(kwargs['thickness'])<500e-6), "a thickness greater than 500 um is not recommended"
                assert (eval(kwargs['thickness'])>1e-6), "a thickness lower than 1 um is not recommended"

                self.attrib.update(kwargs)

            if typ=='Ma':
                Prop = Element('Property')
                Prop.attrib.update(kwargs)
                self.append(Prop)
示例#4
0
 def __init__(self,x=0,y=0,z=[]):
     Element.__init__(self,'Vertex')
     if z==[]:
         #2D
         self.attrib['X1'] = str(x)
         self.attrib['X2'] = str(y)
     else:
         #3D
         self.text = str(x)+','+str(y)+','+str(z)
     pass
示例#5
0
 def __init__(self, parentOrSibling, pot, name, indent):
     Element.__init__(self, pot)
     self.set('name', name)
     self.indent = indent
     self.notes = None
     parent = parentOrSibling
     while parent is not None:
         if parent.indent < indent:
             parent.addProject(self)
             break
         parent = parent.parent
     self.parent = parent
示例#6
0
    def __init__(self,name="Et",DumpMode='nointerp',save='vtk'):
        """

        Parameters
        ----------

        name : string
            name of the DumpBox (def = 'Et')

        DumpMode : string
            'none' : No Interpolation
            'node' : Node Interpolation
            'cell' : Cell Interpolation

        DumpType:  string
                'et' :  E-field time-domain dump (default)  (0)
                'ht' :  H-field time-domain dump (1)
                'jt' :  electric current time-domain (2)
                'tt' :  total current density (rot(H)) (3)

                 'ef' : E-field frequency-domain (10)
                 'hf' : H-field frequency-domain (11)
                 'jf' : for electric current frequency-domain (12)
                 'tf' : total current density (rot(H)) (13)

                 'sar' :  local SAR  (20)
                 'sarg' :  1g averaging SAR (21)
                 'sarggg' : 10g averaging SAR (22)

                 'raw' :  raw data needed for SAR calculations
                 (electric field FD,cell volume, conductivity and density) (29)

        save : string
                'vtk'  : 0
                'hdf5' : 1

        """

        dumptype = {'et':0,'ht':1,'jt':2,'tt':2,'ef':10,'hf':11,'jf':12,'tf':13,'sar':20,'sarg':21,'sargg':22,'raw':29}
        savetype = {'vtk':0,'hdf5':1}

        Element.__init__(self,'DumpBox')

        self.attrib['Name']  =name
        if DumpMode=='none':
            self.attrib['DumpMode']="0"
        if DumpMode=='node':
            self.attrib['DumpMode']="1"
        if DumpMode=='cell':
            self.attrib['DumpMode']="2"
        Prim = Element('Primitives')
        self.append(Prim)
示例#7
0
    def __init__(self,**kwargs):
        defaults = {'elevation' : -1,
                    'pr':10,
                    'lp':np.array([[0,10],
                                 [50,27.1010071662834],
                                 [50,-27.1010071662834],
                                 [0,-10]]),
                    'normdir':1,
                    'length':2}
        for k in defaults:
            if k not in kwargs:
                kwargs[k]=defaults[k]

        Element.__init__(self,'LinPoly', Priority=str(kwargs['pr']),Elevation=str(kwargs['elevation']),Length=str(kwargs['length']),NormDir=str(kwargs['normdir']))
        for p in kwargs['lp']:
            self.append(Vertex(x=p[0],y=p[1],z=[]))
示例#8
0
 def __init__(self,BC=['MUR','MUR','MUR','MUR','MUR','MUR']):
   Element.__init__(self,'BoundaryCond')
   if type(BC[0])==str:
     self.attrib['xmin']=BC[0]
     self.attrib['xmax']=BC[1]
     self.attrib['ymin']=BC[2]
     self.attrib['ymax']=BC[3]
     self.attrib['zmin']=BC[4]
     self.attrib['zmax']=BC[5]
   else:
     dtrans={0:"PEC",1:"PMC",2:"MUR",3:"PML"}
     self.attrib['xmin']=dtrans[BC[0]]
     self.attrib['xmax']=dtrans[BC[1]]
     self.attrib['ymin']=dtrans[BC[2]]
     self.attrib['ymax']=dtrans[BC[3]]
     self.attrib['zmin']=dtrans[BC[4]]
     self.attrib['zmax']=dtrans[BC[5]]
示例#9
0
    def __init__(self,LP,Priority=1,elevation=254,normdir=2,coordsystem=0):
        """
        Parameters
        ----------

        Priority
        Elevation

        """
        Element.__init__(self,'Polygon',
                         Priority=str(Pr),
                         Elevation=str(elevation),
                         NormDir=str(normdir),
                         CoordSystem=str(coordsystem))
        for P in LP:
            V = Vertex(x=P[0],y=P[1])
            self.append(V)
示例#10
0
    def __init__(self,typ='Gaussian',**kwargs):
        dtrans={'Gaussian':0,
                'Sinus':1,
                'Dirac':2,
                'Step':3,
                'Custom':10}
        Element.__init__(self,'Excitation',Type=str(dtrans[typ]))
        if typ=='Gaussian':
            self.attrib['f0']=str(kwargs['f0'])
            self.attrib['fc']=str(kwargs['fc'])
            self.attrib['f_max']=str(kwargs['f0']+kwargs['fc'])

        if typ=='Sinus':
            self.attrib['f0']=str(kwargs['f0'])
            if 'f_max' in kwargs:
              self.attrib['f_max']=str(kwargs['f_max'])

        if typ=='Custom':
            self.attrib['f0']=str(kwargs['f0'])
            self.attrib['Function']=str(kwargs['funcStr'])
示例#11
0
    def __init__(self,X,Y,Z,CoordSystem=0,DeltaUnit="1"):
        """
        Parameters
        ----------

        X  : np.array
        Y  : np.array
        Z  : np.array
        CoordSystem : int
            default 0 : cartesian
        DeltaUnit : string
            default "1"

        """
        if CoordSystem==0:
            Element.__init__(self,'RectilinearGrid')
            self.attrib['DeltaUnit']=DeltaUnit
            self.attrib['CoordSystem']='0'
            self.append(XLines(X))
            self.append(YLines(Y))
            self.append(ZLines(Z))
示例#12
0
    def __init__(self,LP= [[0,0,0],
                          [1,0,0],
                          [0,1,0],
                          [0,0,1]]
                     ,LV= [[0,1,2],
                           [1,2,3],
                           [0,1,3],
                           [0,2,3]],
                      Pr=0):
        """
        Parameters
        ----------

        LP : List of Points
        LV : List of vertex indexes
        Pr : Priority

        """
        Element.__init__(self,'Polyhedron',Priority=str(Pr))
        for P in LP:
            self.append(Vertex(x=P[0],y=P[1],z=P[2]))
            self.append(Face(x=P[0], y=P[1],z=P[2]))
示例#13
0
 def __init__(self):
     Element.__init__(self,'Transformation')
示例#14
0
 def __init__(self,point ,Pr):
      Element.__init__(self,'Curve',Priority=str(Pr))
      for P in LP:
          V = Vertex(x=P[0],y=P[1],z=P[2])
          self.append(V)
示例#15
0
 def __init__(self,name,p):
     Element.__init__(self,name,X=str(p[0]),Y=str(p[1]),Z=str(p[2]))
示例#16
0
 def __init__(self,P1,P2,Pr):
     Element.__init__(self,'Box',Priority=str(Pr))
     self.append(Point('P1',P1))
     self.append(Point('P2',P2))
示例#17
0
 def __init__(self,P,R=50,Pr=10):
     Element.__init__(self,'Sphere',Priority=str(Pr),Radius=str(R))
     self.append(Point('Center',P))
示例#18
0
from xml.etree.ElementTree import Element
from xml.etree import ElementTree

class ProbeBox(Element):
	def __init__(self, Name='port_ut1', Type='wv', Weight='1'):
"""

type:     0 for voltage probing => 'vp'
          1 for current probing => 'cp'
          2 for E-field probing => 'Efp'
          3 for H-field probing => 'Hfp'
          10 for waveguide voltage mode matching => 'wv'
         11 for waveguide current mode matching => 'wc'

"""
	Element.__init__(self,'ProbeBox')
	self.attrib['Weight']=Weight
	if Type=='vp'
		self.attrib['Type']='0'
	if Type=='cp'
		self.attrib['Type']='1'
	if Type=='Efp'
		self.attrib['Type']='2'
	if Type=='Hfp'
		self.attrib['Type']='3'
	if Type=='wv'
		self.attrib['Type']='10'
	if Type=='wc'
		self.attrib['Type']='11'
    self.append(Attributes('Attributes',a))
示例#19
0
	def __init__(self, name, a):
	Element.__init__(self, name, ModeFunctionX=str(a[0]), ModeFunctionY=str(a[1]), ModeFunctionZ=str(a[2]))
示例#20
0
 def __init__(self,CoordSystem=0):
     if CoordSystem==0:
         Element.__init__(self,'ContinuousStructure',CoordSystem=str(CoordSystem))
         # CSX has always a Properties Section
         P = Element('Properties')
         self.append(P)
示例#21
0
 def __init__(self, form: str, form_id: int = 0) -> None:
     """Constructor for the Form class."""
     Element.__init__(self, form, attrib={"form_id": str(form_id)})
示例#22
0
 def __init__(self, FDTD, CSX):
     Element.__init__(self, 'openEMS')
     self.append(FDTD)
     self.append(CSX)
示例#23
0
 def __init__(self,X=np.arange(-10,31,1)):
     Element.__init__(self,'ZLines')
     c=reduce(lambda a,b: str(a)+','+str(b),X)
     self.text = c
示例#24
0
 def __init__(self,FDTD,CSX):
     Element.__init__(self,'openEMS')
     self.append(FDTD)
     self.append(CSX)
示例#25
0
 def __init__(self,p):
     Element.__init__(self,'Translate',Argument=str(p[0])+","+str(p[1])+","+str(p[2]))
示例#26
0
 def __init__(self,ang):
     Element.__init__(self,'Rotate_Z',Argument=str(ang))
示例#27
0
 def __init__(self, x=0, y=0, z=0):
     Element.__init__(self, 'Face')
     self.text = str(x)+','+str(y)+','+str(z)
示例#28
0
 def __init__(self, name, a):
     Element.__init__(self, name, ModeFunctionX=str(a[0]), ModeFunctionY=str(a[1]), ModeFunctionZ=str(a[2]))
示例#29
0
 def __init__(self,P1,P2,Radius=50,Priority=10):
     Element.__init__(self,'Cylinder')
     self['Priority'] = Priority
     self['P1'] = Point(P1)
     self['P2'] = Point(P2)
     self['Radius']  = Radius
示例#30
0
 def __init__(self,Name,Type=0,Weight=-1):
     Element.__init__(self,'ProbeBox',
                      Name=Name,
                      Type=Type,
                      Wieght=Weight)
示例#31
0
    def __init__(self, name="Et", DumpMode='nointerp', save='vtk'):
        """

        Parameters
        ----------

        name : string
            name of the DumpBox (def = 'Et')

        DumpMode : string
            'none' : No Interpolation
            'node' : Node Interpolation
            'cell' : Cell Interpolation

        DumpType:  string
                'et' :  E-field time-domain dump (default)  (0)
                'ht' :  H-field time-domain dump (1)
                'jt' :  electric current time-domain (2)
                'tt' :  total current density (rot(H)) (3)

                 'ef' : E-field frequency-domain (10)
                 'hf' : H-field frequency-domain (11)
                 'jf' : for electric current frequency-domain (12)
                 'tf' : total current density (rot(H)) (13)

                 'sar' :  local SAR  (20)
                 'sarg' :  1g averaging SAR (21)
                 'sarggg' : 10g averaging SAR (22)

                 'raw' :  raw data needed for SAR calculations
                 (electric field FD,cell volume, conductivity and density) (29)

        save : string
                'vtk'  : 0
                'hdf5' : 1

        """

        dumptype = {
            'et': 0,
            'ht': 1,
            'jt': 2,
            'tt': 2,
            'ef': 10,
            'hf': 11,
            'jf': 12,
            'tf': 13,
            'sar': 20,
            'sarg': 21,
            'sargg': 22,
            'raw': 29
        }
        savetype = {'vtk': 0, 'hdf5': 1}

        Element.__init__(self, 'DumpBox')

        self.attrib['Name'] = name
        if DumpMode == 'none':
            self.attrib['DumpMode'] = "0"
        if DumpMode == 'node':
            self.attrib['DumpMode'] = "1"
        if DumpMode == 'cell':
            self.attrib['DumpMode'] = "2"
        Prim = Element('Primitives')
        self.append(Prim)