forked from forefireAPI/firefront
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FireFront.h
197 lines (144 loc) · 5.85 KB
/
FireFront.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
/*
Copyright (C) 2012 ForeFire Team, SPE, UniversitŽ de Corse.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 US
*/
#ifndef FIREFRONT_H_
#define FIREFRONT_H_
#include "ForeFireAtom.h"
#include "Visitable.h"
#include "FireNode.h"
#include "ParallelException.h"
#include "FFConstants.h"
#include "Futils.h"
using namespace std;
namespace libforefire{
class FireDomain;
/*! \class FireFront
* \brief Class describing a fire front
*
* A FireFront implements a pointer to the so-called
* 'headNode' and all its 'innerFronts' (also of type
* FireFront). Thanks to 'nextInFront' and 'previousInFront' pointers
* of the FireNode class all the FireNodes constituting
* the FireFront are linked. An iterator is setVal up in
* order to go through all the FireNodes of the
* FireFront.
*/
class FireFront: public ForeFireAtom, Visitable {
size_t numFirenodes; /*!< number of firenodes in the front */
FireNode* headNode; /*!< 'FireNode' of entry for the 'FireFront' */
FireDomain* domain; /*!< domain containing the fire front */
bool expanding; /*!< behavior of the fire front (expanding or contracting) */
FireFront* containingFront; /*!< 'FireFront' containing this one */
list<FireFront*> innerFronts; /*!< inner fire fronts */
list<FireFront*>::iterator innerFront;
/*! \brief local variables for vertices storage */
size_t nvert;
double *vertx, *verty;
/*! \brief local variables in case of spline interpolation */
size_t nspl;
double *h, *x, *y, *a, *b, *c, *rx, *ry, *d2x, *d2y, *u, *z, *gamma;
static int frontNum;
/*! \brief common initailization for all constructors */
void commonInitialization();
/*! \brief Gives local area from a given firenode */
double getLocalArea(FireNode*);
/*! \brief distance from the front */
double distanceFromFront(const double&, const double&);
public:
static bool outputs; /*! boolean for outputs */
/*! \brief Default constructor, to be avoided */
FireFront(FireDomain* = 0);
/*! \brief Constructor for a front included
* in a 'FireDomain' and a containing front */
FireFront(const double&, FireDomain*, FireFront* = 0);
/*! \brief Destructor */
virtual ~FireFront();
/*! \brief Accesssor to the domain */
FireDomain* getDomain();
/*! \brief Accesssor to the containing firefront */
FireFront* getContFront();
/*! \brief Mutator of the containing firefront */
void setContFront(FireFront*);
/*! \brief Accesssor to the head FireNode */
FireNode* getHead();
/*! \brief Mutator of the head FireNode */
void setHead(FireNode*);
/*!< \brief Mutators of the inner fronts */
void addInnerFront(FireFront*);
void removeInnerFront(FireFront*);
list<FireFront*> getInnerFronts();
/*! input function (overloads 'input()' from 'ForeFireAtom') */
void input();
/*! updates the 'FireFront' properties
* (overloads 'update()' from 'ForeFireAtom') */
void update();
/*! computes the next 'FireFront' properties
* and the time of update.
* (overloads 'timeAdvance()' from 'ForeFireAtom') */
void timeAdvance();
/*! Output function */
void output();
/*! \brief Visitor function */
void accept(Visitor*);
/*! \brief Initialize function */
void initialize(double, FireFront*);
/*! \brief behavior of th firefront */
bool isExpanding();
/*! \brief Area of the front */
double getArea();
/*! \brief accessor to the number of firenodes in the firefront */
size_t getNumFN(FireNode*);
size_t getNumFN();
size_t getTotalNumFN();
/*! \brief getter of the position of a firenode in the front */
size_t getPositionInFront(FireNode*);
/*! \brief getter of the number of inner fronts */
int getNumInnerFronts();
int getTotalNumInnerFronts();
/*! \brief spline interpolation of the firefront */
void splineInterp(FireNode*, FFVector&, double&);
void solveTridiagonalSystem(double*, double*, double*, double*
, double*, size_t&);
/*! \brief adding a firenode in the firefront */
void addFireNode(FireNode*, FireNode* = 0);
/*! \brief erasing a firenode from the firefront */
void dropFireNode(FireNode*);
/*! \brief test to see if a marker belongs to this front */
bool contains(FireNode*);
/*! \brief extending the firefront in one direction */
void extend();
/*! \brief handling the possible splits in the firefront */
void split(FireNode*, const double&);
/*! \brief handling the possible merges in the firefront */
void merge(FireNode*, FireNode*);
void mergeInnerFronts(FireNode*, FireNode*);
/*! \brief constructing arrays storing the coordinates
* of the vertices constituting the front */
void storeVertices(double*, double*, size_t&);
void constructVerticesVectors();
void deleteVerticesVectors();
/*! \brief checking the burning status of a given location */
bool checkForBurningStatus(FFPoint&);
/*! \brief computes a rectangle containing the entire front */
void computeBoundingBox(FFPoint&, FFPoint&);
/*! \brief managing the number of firenodes in the front */
void increaseNumFN();
void decreaseNumFN();
/*! \brief making the front a trash one */
void makeTrash();
string toString();
string print(int = 0);
};
}
#endif /* FIREFRONT_H_ */