NANDRAD Data Model Library  Version 2.0
NANDRAD
NANDRAD_WindowDivider.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_WindowDividerH
23 #define NANDRAD_WindowDividerH
24 
25 #include <algorithm>
26 #include <numeric>
27 
28 #include <IBK_Parameter.h>
29 #include <IBK_Exception.h>
30 
31 #include "NANDRAD_CodeGenMacros.h"
32 #include "NANDRAD_Constants.h"
33 #include "NANDRAD_Material.h"
34 
35 namespace NANDRAD {
36 
37 /*! WindowDivider defines the divider of a window. */
39  NANDRAD_READWRITE_PRIVATE
40 public:
41 
42  // *** PUBLIC MEMBER FUNCTIONS ***
43 
44  NANDRAD_READWRITE_IFNOTEMPTY(WindowDivider)
45  NANDRAD_COMP(WindowDivider)
46 
47  void checkParameters(const std::vector<Material> & materials);
48 
49  // *** PUBLIC MEMBER VARIABLES ***
50 
51  /*! Material used for divider (INVALID_ID for no divider). */
52  unsigned int m_materialId = INVALID_ID; // XML:A:required
53  /*! Cross section occupied by all divider elements in this window (required when m_materialID is given). */
54  IBK::Parameter m_area; // XML:E:required
55  /*! Thickness of frame */
56  IBK::Parameter m_thickness; // XML:E:required
57 
58  // *** Variables used only during simulation ***
59 
60  /*! Cached thermal conductivity in [W/mK], retrieved from referenced material in checkParameters(). */
61  double m_lambda = 999;
62 
63 }; // WindowDivider
64 
65 
66 inline bool WindowDivider::operator!=(const WindowDivider & other) const {
67  if (m_materialId != other.m_materialId) return true;
68  if (m_area != other.m_area) return true;
69  return false;
70 }
71 
72 
73 inline void WindowDivider::checkParameters(const std::vector<Material> & materials) {
74  FUNCID(WindowDivider::checkParameters);
75 
76  if (m_materialId == INVALID_ID)
77  return;
78  // search material list for required material
79  std::vector<Material>::const_iterator it = std::find(materials.begin(), materials.end(), m_materialId);
80  if (it == materials.end())
81  throw IBK::Exception(IBK::FormatString("Material with ID %1 not defined.").arg(m_materialId), FUNC_ID);
82  m_lambda = it->m_para[Material::P_Conductivity].value;
83 
84  m_area.checkedValue("Area", "m2", "m2", 0, true, (std::numeric_limits<double>::max)(), true,
85  "Cross section area of dividers must be >= 0 m2.");
86  m_thickness.checkedValue("Thickness", "m", "m", 0, false, (std::numeric_limits<double>::max)(), true,
87  "Thickness of dividers must be > 0 m.");
88 }
89 
90 } // namespace NANDRAD
91 
92 #endif // NANDRAD_WindowDividerH
IBK::Parameter m_area
Cross section occupied by all divider elements in this window (required when m_materialID is given)...
Contains global constants for the Nandrad data model.
double m_lambda
Cached thermal conductivity in [W/mK], retrieved from referenced material in checkParameters().
unsigned int INVALID_ID
defines an invalid id
IBK::Parameter m_thickness
Thickness of frame.
unsigned int m_materialId
Material used for divider (INVALID_ID for no divider).
The namespace NANDRAD contains the data model classes that make up the NANDRAD solver input data...
Thermal conductivity of the dry material.
WindowDivider defines the divider of a window.