File: nec_near_field_pattern.py

package info (click to toggle)
necpp 1.2.4%2Bcvs20060601-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,764 kB
  • ctags: 5,989
  • sloc: cpp: 30,174; ansic: 10,162; fortran: 8,333; python: 2,948; makefile: 186; sh: 1
file content (205 lines) | stat: -rw-r--r-- 6,174 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#nec_near_field_pattern.py

#header generated by SWIG

import _PyNEC

def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
    if (name == "this"):
        if isinstance(value, class_type):
            self.__dict__[name] = value.this
            if hasattr(value,"thisown"): self.__dict__["thisown"] = value.thisown
            del value.thisown
            return
    method = class_type.__swig_setmethods__.get(name,None)
    if method: return method(self,value)
    if (not static) or hasattr(self,name) or (name == "thisown"):
        self.__dict__[name] = value
    else:
        raise AttributeError("You cannot add attributes to %s" % self)

def _swig_setattr(self,class_type,name,value):
    return _swig_setattr_nondynamic(self,class_type,name,value,0)

def _swig_getattr(self,class_type,name):
    method = class_type.__swig_getmethods__.get(name,None)
    if method: return method(self)
    raise AttributeError,name

import types
try:
    _object = types.ObjectType
    _newclass = 1
except AttributeError:
    class _object : pass
    _newclass = 0
del types

#end of the header generated by SWIG



import exceptions

#some utility functions

def _get_nfeh(arg0):
	"""
	Returns the flag indicating whether the result is a near electric or magnetic field pattern.
	"""
	return _PyNEC.nec_near_field_pattern_get_nfeh(arg0)    



#class "near_field_pattern"

class nec_near_field_pattern(_object):
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, nec_near_field_pattern, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, nec_near_field_pattern, name)
    def __init__(self): raise RuntimeError, "No constructor defined"
    def __repr__(self):
        return "<%s.%s; proxy of C++ nec_near_field_pattern instance at %s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
    
    
    def get_frequency(*args):
    	"""
	Returns the frequency in Hertz.
	"""
    	return _PyNEC.nec_near_field_pattern_get_frequency(*args)
    
    
    def get_x(*args):
    	"""
	Returns the array of x-coordinate in meters of field points.
	"""
    	return _PyNEC.nec_near_field_pattern_get_x(*args)
	
	
    def get_y(*args):
    	"""
	Returns the array of y-coordinate in meters of field points.
	"""
    	return _PyNEC.nec_near_field_pattern_get_y(*args)
	
	
    def get_z(*args):
    	"""
	Returns the array of z-coordinate in meters of field points.
	"""
    	return _PyNEC.nec_near_field_pattern_get_z(*args)


    def get_near_field_type(*args):
    	"""
	Returns the type of near field : either magnetic or electric.
	"""
	nfeh = _get_nfeh(*args)
	if nfeh == 0 :
		return "near electric field"
	elif nfeh == 1 :
		return "near magnetic field"
	else :
		error_msg ="Unknown near field type : " + nfeh.__str__() + "."
		raise exceptions.Warning(error_msg)


    def get_e_x(*args):
    	"""
	Returns the array of x_components in volts / meters of the electric field.
	"""
	nfeh = _get_nfeh(*args)
    	if nfeh == 0 :
		return _PyNEC.nec_near_field_pattern_get_field_x(*args)
	elif nfeh == 1:
		error_msg = "This result is a Near Magnetic Field Pattern. Try and get 'h_x' instead."
		raise exceptions.Warning(error_msg)
	else :
		error_msg = "Unknown near_field_type : " + nfeh.__str__() + "."
		raise exceptions.Warning(error_msg)
	
	
    def get_e_y(*args):
    	"""
	Returns the array of y_components in volts / meters of the electric field.
	"""
    	nfeh = _get_nfeh(*args)
    	if nfeh == 0 :
		return _PyNEC.nec_near_field_pattern_get_field_y(*args)
	elif nfeh == 1:
		error_msg = "This result is a Near Magnetic Field Pattern. Try and get 'h_y' instead."
		raise exceptions.Warning(error_msg)
	else :
		error_msg = "Unknown near_field_type : " + nfeh.__str__() + "."
		raise exceptions.Warning(error_msg)
	
		
    def get_e_z(*args):
    	"""
	Returns the array of z_components in volts / meters of the electric field.
	"""
    	nfeh = _get_nfeh(*args)
    	if nfeh == 0 :
		return _PyNEC.nec_near_field_pattern_get_field_z(*args)
	elif nfeh == 1:
		error_msg = "This result is a Near Magnetic Field Pattern. Try and get 'h_z' instead."
		raise exceptions.Warning(error_msg)
	else :
		error_msg = "Unknown near_field_type : " + nfeh.__str__() + "."
		raise exceptions.Warning(error_msg)



    def get_h_x(*args):
    	"""
	Returns the array of x_components in amps / meters of the magnetic field.
	"""
    	nfeh = _get_nfeh(*args)
    	if nfeh == 1 :
		return _PyNEC.nec_near_field_pattern_get_field_x(*args)
	elif nfeh == 0:
		error_msg = "This result is a Near Electric Field Pattern. Try and get 'e_x' instead."
		raise exceptions.Warning(error_msg)
	else :
		error_msg = "Unknown near_field_type : " + nfeh.__str__() + "."
		raise exceptions.Warning(error_msg)
	
	
    def get_h_y(*args):
    	"""
	Returns the array of y_components in amps / meters of the magnetic field.
	"""
    	nfeh = _get_nfeh(*args)
    	if nfeh == 1 :
		return _PyNEC.nec_near_field_pattern_get_field_y(*args)
	elif nfeh == 0:
		error_msg = "This result is a Near Electric Field Pattern. Try and get 'e_y' instead."
		raise exceptions.Warning(error_msg)
	else :
		error_msg = "Unknown near_field_type : " + nfeh.__str__() + "."
		raise exceptions.Warning(error_msg)
	
		
    def get_h_z(*args):
    	"""
	Returns the array of z_components in amps / meters of the magnetic field.
	"""
    	nfeh = _get_nfeh(*args)
    	if nfeh == 1 :
		return _PyNEC.nec_near_field_pattern_get_field_z(*args)
	elif nfeh == 0:
		error_msg = "This result is a Near Electric Field Pattern. Try and get 'e_z' instead."
		raise exceptions.Warning(error_msg)
	else :
		error_msg = "Unknown near_field_type : " + nfeh.__str__() + "."
		raise exceptions.Warning(error_msg)



class nec_near_field_patternPtr(nec_near_field_pattern):
    def __init__(self, this):
        _swig_setattr(self, nec_near_field_pattern, 'this', this)
        if not hasattr(self,"thisown"): _swig_setattr(self, nec_near_field_pattern, 'thisown', 0)
        _swig_setattr(self, nec_near_field_pattern,self.__class__,nec_near_field_pattern)
_PyNEC.nec_near_field_pattern_swigregister(nec_near_field_patternPtr)