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