NANDRAD Data Model Library  Version 2.0
NANDRAD
NANDRAD_WindowFrame.h
1 /* The NANDRAD data model library.
2 
3  Copyright (c) 2012-today, Institut für Bauklimatik, TU Dresden, Germany
4 
5  Primary authors:
6  Andreas Nicolai <andreas.nicolai -[at]- tu-dresden.de>
7  Anne Paepcke <anne.paepcke -[at]- tu-dresden.de>
8 
9  This library is part of SIM-VICUS (https://github.com/ghorwin/SIM-VICUS)
10 
11  This library is free software: you can redistribute it and/or modify
12  it under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU General Public License for more details.
20 */
21 
22 #ifndef NANDRAD_WindowFrameH
23 #define NANDRAD_WindowFrameH
24 
25 #include <algorithm>
26 
27 #include <IBK_Parameter.h>
28 #include <IBK_Exception.h>
29 
30 #include "NANDRAD_CodeGenMacros.h"
31 #include "NANDRAD_Constants.h"
32 #include "NANDRAD_Material.h"
33 
34 namespace NANDRAD {
35 
36 
37 /*! WindowFrame defines the frame of a window.
38 
39  \todo Extend this class to hold alternative ways for defining a frame.
40 */
41 class WindowFrame {
42  NANDRAD_READWRITE_PRIVATE
43 public:
44 
45  // *** PUBLIC MEMBER FUNCTIONS ***
46 
47  NANDRAD_READWRITE_IFNOTEMPTY(WindowFrame)
48  NANDRAD_COMP(WindowFrame)
49 
50  void checkParameters(const std::vector<Material> & materials);
51 
52  // *** PUBLIC MEMBER VARIABLES ***
53 
54  /*! Material used for frame (INVALID_ID for no frame). */
55  unsigned int m_materialId = INVALID_ID; // XML:A:required
56  /*! Cross section occupied by all frame elements in this window (required when m_materialID is given). */
57  IBK::Parameter m_area; // XML:E:required
58  /*! Thickness of frame */
59  IBK::Parameter m_thickness; // XML:E:required
60 
61  // *** Variables used only during simulation ***
62 
63  /*! Cached thermal conductivity in [W/mK], retrieved from referenced material in checkParameters(). */
64  double m_lambda = 999;
65 
66 }; // WindowFrame
67 
68 
69 inline bool WindowFrame::operator!=(const WindowFrame & other) const {
70  if (m_materialId != other.m_materialId) return true;
71  if (m_area != other.m_area) return true;
72  return false;
73 }
74 
75 
76 inline void WindowFrame::checkParameters(const std::vector<Material> & materials) {
77  FUNCID(WindowFrame::checkParameters);
78 
79  if (m_materialId == INVALID_ID)
80  return;
81  // search material list for required material
82  std::vector<Material>::const_iterator it = std::find(materials.begin(), materials.end(), m_materialId);
83  if (it == materials.end())
84  throw IBK::Exception(IBK::FormatString("Material with ID %1 not defined.").arg(m_materialId), FUNC_ID);
85  m_lambda = it->m_para[Material::P_Conductivity].value;
86 
87  m_area.checkedValue("Area", "m2", "m2", 0, true, (std::numeric_limits<double>::max)(), true,
88  "Cross section area of frame must be >= 0 m2.");
89  m_thickness.checkedValue("Thickness", "m", "m", 0, false, (std::numeric_limits<double>::max)(), true,
90  "Thickness of frame must be > 0 m.");
91 }
92 
93 
94 } // namespace NANDRAD
95 
96 #endif // NANDRAD_WindowFrameH
Contains global constants for the Nandrad data model.
unsigned int INVALID_ID
defines an invalid id
unsigned int m_materialId
Material used for frame (INVALID_ID for no frame).
IBK::Parameter m_thickness
Thickness of frame.
WindowFrame defines the frame of a window.
IBK::Parameter m_area
Cross section occupied by all frame elements in this window (required when m_materialID is given)...
double m_lambda
Cached thermal conductivity in [W/mK], retrieved from referenced material in checkParameters().
The namespace NANDRAD contains the data model classes that make up the NANDRAD solver input data...
Thermal conductivity of the dry material.