Initial Commit
[HECS.git] / HeatLossElement.cpp
blob04a05012c909741f50a2806d0c3d49f8e8094f44
1 /***************************************************************************
2 * *
3 * HeatLossElement.cpp Copyright (C) 2008 by Jon Rumble *
4 * j.w.rumble@reading.ac.uk *
5 * *
6 * This file is part of HECS, *
7 * *
8 * HECS 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 * HECS 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 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * You should have received a copy of the GNU General Public License *
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
21 ***************************************************************************/
23 #include "HeatLossElement.h"
24 // Constructors/Destructors
27 HeatLossElement::HeatLossElement() { }
29 HeatLossElement::~HeatLossElement () { }
32 void HeatLossElement::insertLoss(const QString& name,double area, double uValue)
34 HeatLossItem item (area,uValue);
35 elemMap.insert(name,item);
38 void HeatLossElement::removeLoss(const QString& name)
40 elemMap.remove(name);
43 void HeatLossElement::updateLoss(const QString& name,double area,double uValue)
45 removeLoss(name);
46 insertLoss(name,area,uValue);
51 // Methods
54 void HeatLossElement::calcElementTotal()
57 m_elementLossTotal = 0.00;
58 m_elementAreaTotal = 0.00;
59 QMapIterator <QString, HeatLossItem> i (elemMap);
61 while (i.hasNext())
63 i.next();
64 HeatLossItem temp = i.value();
65 m_elementLossTotal += temp.getwK();
66 m_elementAreaTotal += temp.getArea();
72 // Accessor methods
75 double HeatLossElement::getElementLossTotal()
77 calcElementTotal();
78 return m_elementLossTotal;
81 void HeatLossElement::setElementLossTotal(double val_in)
83 m_elementLossTotal = val_in;
86 double HeatLossElement::getElementAreaTotal()
88 calcElementTotal();
89 return m_elementAreaTotal;
92 void HeatLossElement::setAreaElementTotal(double val_in)
94 m_elementLossTotal = val_in;