FEMTIC
Forward2D.h
Go to the documentation of this file.
1 //-------------------------------------------------------------------------------------------------------
2 // The MIT License (MIT)
3 //
4 // Copyright (c) 2021 Yoshiya Usui
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to deal
8 // in the Software without restriction, including without limitation the rights
9 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 // copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // The above copyright notice and this permission notice shall be included in all
14 // copies or substantial portions of the Software.
15 //
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 // SOFTWARE.
23 //-------------------------------------------------------------------------------------------------------
24 #ifndef DBLDEF_FORWARD_2D
25 #define DBLDEF_FORWARD_2D
26 
27 #include <complex>
29 
30 // Class of 2D forward calculation
31 class Forward2D{
32 
33 public:
34 
35  // Constructer
36  explicit Forward2D( const int planeID, const int iPol );
37 
38  // Destructer
39  ~Forward2D();
40 
41  // Get result of forward analysis directly from solution array;
42  std::complex<double> getSolutionDirectly( const int freedum ) const;
43 
44  // Get result of forward analysis from element ID and local node(edge) ID
45  std::complex<double> getSolutionFromLocalID( const int iElem, const int localID ) const;
46 
47 protected:
48 
49  // Flag specifing the types of 2D analysis
56  };
57 
58  struct Matrix2x2{
59  double mat11;
60  double mat12;
61  double mat21;
62  double mat22;
63  };
64 
65  // Whether electric field specified at the top of the model as source
66  static const bool m_sourceFieldElectric = true;
67 
68  // Whether horizontal electric field specified at the left and right side for analysis with edge-based element
69  static const bool m_specifyTEResultToSidesOfEdgeElement = false;
70 
71  // ID of boundary plane
72  int m_planeID;
73 
74  // ID of polarization
76 
78  //int m_typeOf2DAnalysis;
79 
80  // Array of the matrix of 2D anaysis ( TM & TE mode )
82 
83  // Whether matrix structure has already been set or not
85 
86  // Solution vector of 2D analysis
87  std::complex<double>* m_solution;
88 
89  // Array converting local IDs to global ones
91 
92  // Array converting local IDs to global ones after degeneration
94 
95  // Whether array converting local edge IDs to global ones and global ones after degeneration has already been set or not
97 
98  // Return TM or TE mode from ploralization and plane ID
99  int calcMode() const;
100 
101 private:
102 
103  // Defailt constructer
105 
106  // Copy constructer
107  Forward2D(const Forward2D& rhs);
108 
109  // Copy assignment operator
110  Forward2D& operator=(const Forward2D& rhs);
111 
112  // Set ID of boundary plane
113  void setPlaneID( const int planeID );
114 
115  // Initialize matrix solver
116  void initializeMatrixSolver();
117 
118 };
119 
120 #endif
Definition: ComplexSparseSquareSymmetricMatrix.h:32
Definition: Forward2D.h:31
std::complex< double > getSolutionDirectly(const int freedum) const
Definition: Forward2D.cpp:118
~Forward2D()
Definition: Forward2D.cpp:59
int calcMode() const
Definition: Forward2D.cpp:148
std::complex< double > * m_solution
Definition: Forward2D.h:87
int m_polarization
Definition: Forward2D.h:75
static const bool m_specifyTEResultToSidesOfEdgeElement
Definition: Forward2D.h:69
typeOf2DAnalysis
Definition: Forward2D.h:50
@ EDGE_BASED_ZEROTH_ORDER
Definition: Forward2D.h:54
@ NODE_BASED_FIRST_ORDER
Definition: Forward2D.h:52
@ NODE_BASED_SECOND_ORDER
Definition: Forward2D.h:53
@ NOT_ASSIGNED
Definition: Forward2D.h:51
@ EDGE_BASED_FIRST_ORDER
Definition: Forward2D.h:55
static const bool m_sourceFieldElectric
Definition: Forward2D.h:66
Forward2D & operator=(const Forward2D &rhs)
Definition: Forward2D.cpp:176
ComplexSparseSquareSymmetricMatrix m_matrix2DAnalysis
Definition: Forward2D.h:81
int m_planeID
Definition: Forward2D.h:72
int ** m_IDsLocal2GlobalDegenerated
Definition: Forward2D.h:93
bool m_hasMatrixStructureSetAndAnalyzed
Definition: Forward2D.h:84
std::complex< double > getSolutionFromLocalID(const int iElem, const int localID) const
Definition: Forward2D.cpp:131
int ** m_IDsLocal2Global
Definition: Forward2D.h:90
void initializeMatrixSolver()
Definition: Forward2D.cpp:104
void setPlaneID(const int planeID)
Definition: Forward2D.cpp:89
bool m_hasAlreadySetIDsLocal2Global
Definition: Forward2D.h:96
Definition: Forward2D.h:58
double mat21
Definition: Forward2D.h:61
double mat22
Definition: Forward2D.h:62
double mat12
Definition: Forward2D.h:60
double mat11
Definition: Forward2D.h:59