FEMTIC
MeshDataBrickElement.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_MESHDATA_BRICKELEMENT
25 #define DBLDEF_MESHDATA_BRICKELEMENT
26 
27 #include <vector>
28 #include "MeshData.h"
29 
30 // Class of FEM mesh for brick element
32 
33 public:
34 
35  // Constructer
37 
38  // Destructer
39  virtual ~MeshDataBrickElement();
40 
41  // Input mesh data from "mesh.dat"
42  virtual void inputMeshData();
43 
44  // Find element including a point
45  int findElementIncludingPoint( const double locX, const double locY, const double locZ,
46  double& localCoordX, double& localCoordY, double& localCoordZ, const bool useUpperElem,
47  const bool modLoc, double& locXMod, double& locYMod ) const;
48 
49  // Find elements including point on the surface of the earth
50  int findElementIncludingPointOnSurface( const double locX, const double locY,
51  double& localCoordX, double& localCoordY, double& localCoordZ, const bool useUpperElem,
52  const bool modLoc, double& locXMod, double& locYMod ) const;
53 
54  // Find elements including dipole on the surface of the earth
55  void findElementsIncludingDipoleOnSurface( const double locXStart, const double locYStart, const double locXEnd, const double locYEnd,
56  std::vector<int>& elements, std::vector<double>& localCoordXStartPoint, std::vector<double>& localCoordYStartPoint, std::vector<double>& localCoordXEndPoint, std::vector<double>& localCoordYEndPoint ) const;
57 
58  // Get length of the edges parallel to X coordinate
59  double getEdgeLengthX( const int iElem ) const;
60 
61  // Get length of the edges parallel to Y coordinate
62  double getEdgeLengthY( const int iElem ) const;
63 
64  // Get length of the edges parallel to Z coordinate
65  double getEdgeLengthZ( const int iElem ) const;
66 
67  // Get global X coordinate from local coordinate
68  double calcGlobalCoordX( const int iElem, double localCoordX ) const;
69 
70  // Get global Y coordinate from local coordinate
71  double calcGlobalCoordY( const int iElem, double localCoordY ) const;
72 
73  // Get global Z coordinate from local coordinate
74  double calcGlobalCoordZ( const int iElem, double localCoordZ ) const;
75 
76  // Get number of Elements parallel to X direction
77  int getNumElemX() const;
78 
79  // Get number of Elements parallel to Y direction
80  int getNumElemY() const;
81 
82  // Get number of Elements parallel to Z direction
83  int getNumElemZ() const;
84 
85  // Get number of the air layer
86  int getNumAirLayer() const;
87 
88  // Calculate number of edges of X-Y plane
89  int calcNumEdgesOnXYPlane() const;
90 
91  // Calculate number of edges of Y-Z plane
92  int calcNumEdgesOnYZPlane() const;
93 
94  // Calculate number of edges of Z-X plane
95  int calcNumEdgesOnZXPlane() const;
96 
97  // Get ID of the nodes of elements belonging to the boundary planes
98  virtual int getNodesOfElementsBoundaryPlanes( const int iPlane, const int iElem, const int iNode ) const;
99 
100  // Get mesh type
101  virtual int getMeshType() const;
102 
103  // Decide whether specified elements share same edges
104  virtual bool shareSameEdges( const int elemID1, const int elemID2 ) const;
105 
106  // Calculate volume of a specified element
107  virtual double calcVolume( const int elemID ) const;
108 
109  // Calculate area of face
110  virtual double calcAreaOfFace( const int iElem, const int iFace ) const;
111 
112  // Calculate area of face at bottom of mesh
113  virtual double calcAreaOfFaceAtBottomOfMesh( const int iElem ) const;
114 
115  // Output mesh data to VTK file
116  virtual void outputMeshDataToVTK() const;
117 
118  // Output mesh data to binary file
119  virtual void outputMeshDataToBinary() const;
120 
121 private:
122 
123  // Copy constructer
125 
126  // Copy assignment operator
128 
129  // Number of Elements parallel to X direction
131 
132  // Number of Elements parallel to Y direction
134 
135  // Number of Elements parallel to Z direction
137 
138  // Number of the air layer
140 
141  // Array of edge lenghts
142  double* m_edgeLength;
143 
144  // Array of nodes of elements belonging to the boundary planes
145  // m_nodesOfElementsBoundaryPlanes[0] : Y-Z Plane ( Minus Side )
146  // m_nodesOfElementsBoundaryPlanes[1] : Y-Z Plane ( Plus Side )
147  // m_nodesOfElementsBoundaryPlanes[2] : Z-X Plane ( Minus Side )
148  // m_nodesOfElementsBoundaryPlanes[3] : Z-X Plane ( Plus Side )
149  // m_nodesOfElementsBoundaryPlanes[4] : X-Y Plane ( Minus Side )
150  // m_nodesOfElementsBoundaryPlanes[5] : X-Y Plane ( Plus Side )
152 
153  // Get local coordinate values from coordinate values
154  virtual void getLocalCoordinateValues( const int iElem, const double coordX, const double coordY, const double coordZ,
155  double& localCoordX, double& localCoordY, double& localCoordZ ) const;
156 
157 };
158 
159 #endif
Definition: MeshDataBrickElement.h:31
virtual bool shareSameEdges(const int elemID1, const int elemID2) const
Definition: MeshDataBrickElement.cpp:705
double getEdgeLengthZ(const int iElem) const
Definition: MeshDataBrickElement.cpp:597
virtual void outputMeshDataToBinary() const
Definition: MeshDataBrickElement.cpp:877
virtual void outputMeshDataToVTK() const
Definition: MeshDataBrickElement.cpp:839
virtual double calcAreaOfFaceAtBottomOfMesh(const int iElem) const
Definition: MeshDataBrickElement.cpp:832
virtual int getNodesOfElementsBoundaryPlanes(const int iPlane, const int iElem, const int iNode) const
Definition: MeshDataBrickElement.cpp:678
MeshDataBrickElement & operator=(const MeshDataBrickElement &rhs)
Definition: MeshDataBrickElement.cpp:87
int getNumElemX() const
Definition: MeshDataBrickElement.cpp:643
int m_numElemY
Definition: MeshDataBrickElement.h:133
void findElementsIncludingDipoleOnSurface(const double locXStart, const double locYStart, const double locXEnd, const double locYEnd, std::vector< int > &elements, std::vector< double > &localCoordXStartPoint, std::vector< double > &localCoordYStartPoint, std::vector< double > &localCoordXEndPoint, std::vector< double > &localCoordYEndPoint) const
Definition: MeshDataBrickElement.cpp:388
int * m_nodesOfElementsBoundaryPlanes[6]
Definition: MeshDataBrickElement.h:151
virtual int getMeshType() const
Definition: MeshDataBrickElement.cpp:698
double getEdgeLengthY(const int iElem) const
Definition: MeshDataBrickElement.cpp:587
int findElementIncludingPoint(const double locX, const double locY, const double locZ, double &localCoordX, double &localCoordY, double &localCoordZ, const bool useUpperElem, const bool modLoc, double &locXMod, double &locYMod) const
Definition: MeshDataBrickElement.cpp:306
double calcGlobalCoordX(const int iElem, double localCoordX) const
Definition: MeshDataBrickElement.cpp:607
virtual double calcAreaOfFace(const int iElem, const int iFace) const
Definition: MeshDataBrickElement.cpp:802
int findElementIncludingPointOnSurface(const double locX, const double locY, double &localCoordX, double &localCoordY, double &localCoordZ, const bool useUpperElem, const bool modLoc, double &locXMod, double &locYMod) const
Definition: MeshDataBrickElement.cpp:378
int m_numAirLayer
Definition: MeshDataBrickElement.h:139
int calcNumEdgesOnXYPlane() const
Definition: MeshDataBrickElement.cpp:663
int m_numElemZ
Definition: MeshDataBrickElement.h:136
int calcNumEdgesOnZXPlane() const
Definition: MeshDataBrickElement.cpp:673
virtual ~MeshDataBrickElement()
Definition: MeshDataBrickElement.cpp:60
double calcGlobalCoordZ(const int iElem, double localCoordZ) const
Definition: MeshDataBrickElement.cpp:631
double calcGlobalCoordY(const int iElem, double localCoordY) const
Definition: MeshDataBrickElement.cpp:619
int getNumElemZ() const
Definition: MeshDataBrickElement.cpp:653
virtual void inputMeshData()
Definition: MeshDataBrickElement.cpp:93
virtual double calcVolume(const int elemID) const
Definition: MeshDataBrickElement.cpp:794
virtual void getLocalCoordinateValues(const int iElem, const double coordX, const double coordY, const double coordZ, double &localCoordX, double &localCoordY, double &localCoordZ) const
Definition: MeshDataBrickElement.cpp:983
double getEdgeLengthX(const int iElem) const
Definition: MeshDataBrickElement.cpp:577
int calcNumEdgesOnYZPlane() const
Definition: MeshDataBrickElement.cpp:668
int getNumElemY() const
Definition: MeshDataBrickElement.cpp:648
int m_numElemX
Definition: MeshDataBrickElement.h:130
double * m_edgeLength
Definition: MeshDataBrickElement.h:142
int getNumAirLayer() const
Definition: MeshDataBrickElement.cpp:658
MeshDataBrickElement()
Definition: MeshDataBrickElement.cpp:41
Definition: MeshData.h:31