nec2++  1.7.0
electromag.h
1 #ifndef __electromag__
2 #define __electromag__
3 
4 /*
5  Various Useful Electromagnetism Utilities for nec2cpp
6 
7  Copyright (C) 2004-2006 Timothy C.A. Molteno
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23 
24 #include <cmath>
25 #include <complex>
26 
27 #include "math_util.h"
28 
29 namespace em
30 {
31 
32 class constants
33 {
34 public:
35  static nec_float permittivity;
36  static nec_float permeability;
37 };
38 
39 // Calculate the power from a voltage and a current.
40 inline nec_float power(nec_complex voltage, nec_complex current)
41 {
42  return 0.5* real(voltage * conj(current));
43 }
44 
45 // Electromagnetic Constants
46 
47 inline nec_float permittivity()
48 {
49  return constants::permittivity;
50 }
51 
52 inline nec_float permeability()
53 {
54  return constants::permeability;
55 }
56 
57 nec_float speed_of_light();
58 nec_float impedance();
59 nec_float inverse_impedance();
60 nec_float impedance_over_2pi();
61 
62 }
63 
64 #endif /* __electromag__ */
Definition: electromag.h:32
Definition: electromag.h:29