C++ API Reference
This section will contain the C++ API reference, automatically generated from source code comments using Doxygen and Breathe.
Key C++ classes providing the core functionality of ForeFire include:
-
class FireDomain : public libforefire::ForeFireAtom, private libforefire::Visitable
Class describing the “world” of the simulation.
FireDomain represents all the data and models provided to simulate the fire propagation. It embodies the ‘FireFronts’, the ‘boundaries’, the ‘dataBroker’ and physical models necessary for the simulation.
Public Functions
-
FireDomain()
Default constructor.
boolean if some has been read
-
FireDomain(const double&, FFPoint&, FFPoint&)
Constructor with boundaries and time.
-
FireDomain(const int&, const int&, const int&, const int&, const double&, const double&, const double&, const int&, const double*, const int&, const double*, const int&, const double&)
Constructor with boundaries, time and reference longitude and latitude.
-
virtual ~FireDomain()
Destructor.
-
double getSimulationTime()
present time of the simulation
-
void backupState()
Storing information of the simulation.
-
void restoreValidState()
Returning to a valid state of simulation.
-
int getReferenceYear()
Accessors.
-
void validateTopology(string)
validating the topology for the nodes in the simulation
-
void setSafeTopologyMode(bool)
Setting the safe mode for topology.
-
int getMaxComNodes()
give Max com nodes
-
virtual void update()
updates the ‘FireDomain’ (overloads ‘update()’ from ‘ForeFireAtom’)
-
virtual void timeAdvance()
computes the next FireDomain properties (overloads ‘timeAdvance()’ from ‘ForeFireAtom’)
-
virtual void output()
Output function
-
void addNewAtomToSimulation(ForeFireAtom*)
inserting a newly created atom in the simulation
-
void deleteAtomOfSimulation(ForeFireAtom*)
deleting an atom in the simulation
-
FluxLayer<double> *getFluxLayer(const string&)
getting a specified flux layer
-
virtual void accept(Visitor*)
visitor function
-
bool striclyWithinDomain(FFPoint&)
Test on the location.
-
bool firenodeInList(FireNode*, const list<FireNode*>&)
Test to see if a firenode pertains to a list.
-
FireNodeData *idInList(const double&, const list<FireNodeData*>&)
Test to see if a firenode data pertains to a list.
-
FireNodeData *posInList(const double&, const double&, const list<FireNodeData*>&)
Test to see if a position is in a list.
-
FFPoint findIntersection(FFPoint&, FFPoint&, FFPoint&, FFPoint&)
finding the intersection between two segments
-
FFPoint findIntersectionWithBoundingBox(FFPoint&, FFPoint&, FFPoint&, FFPoint&, int&)
finding the intersection with a bounding box
-
bool isBurning(FFPoint&, const double&)
checking if a location is burning
-
double getModelValueAt(int&, FFPoint&, const double&, const double&, const double&)
Computing the propagation speed of a given firenode.
-
void removeFireNodeInCell(FireNode*)
finds the related cell and remove a given firenode to the list
-
list<FireNode*> getNodesWithin(FireNode*, const double&, bool = true)
listing all the firenodes close to a given one
-
list<FireNode*> getPhysicalDomainNodesWithin(FFPoint&, const double&, bool = true)
listing all the firenodes, in the physical domain, close to a given one
-
void saveArrivalTimeNC()
saving the simulation
-
void loadArrivalTimeNC(string)
loading the simulation
-
void dumpBurningMatrixAsBinary()
dumping the map of arrival times for debugging
-
virtual string toString()
print function
-
void computeBoundingBox(FireNode*, FireNode*, FireNode*, FFPoint&, FFPoint&)
defining a bounding box containing three fire nodes
-
void constructLocalSurroundingPolygon(FireNode*, FFPoint&, FFPoint&, vector<double>&, vector<double>&)
defining an optimized polygon around a firenode and its neighbors
-
void frontInitialBurningScan(const double&, FireFront*, const double&, const double&)
initial burning scan
-
void frontBurningScan(FireFront*, const double&)
global scanning for burning matrix during simulation
-
void singlePolygonAreaBurningScan(FFPoint&, FFPoint&, double, bool, size_t&, double*, double*)
scanning a region according to one polygon
-
void areaBurningScan(FFPoint&, FFPoint&, double)
scanning a region with respect to all fire fronts
-
std::vector<std::vector<double>> getDataMatrix(const std::string&)
retrun a diag matrix
-
bool checkForBurningStatus(FFPoint&)
checking the burning status of a given location
Public Members
-
FFPoint SWLngLat
SouthWest Corner of the mesh
-
FFPoint NELngLat
NorthEast Corner of the mesh
-
bool parallel
boolean for coupled simulations
-
bool isFireActive
boolean for parallel simulations
Public Static Attributes
-
static const size_t NUM_MAX_PROPMODELS = 50
maximum number of propagation models
-
static const size_t NUM_MAX_FLUXMODELS = 500
maximum number of flux models
-
static bool outputs = false
boolean for command outputs
-
static bool recycleNodes = false
boolean for outputs
-
static const FFPoint outPoint = FFPoint(numeric_limits<double>::infinity(), numeric_limits<double>::infinity(), 0)
finding the intersection between a segment and the frontier
-
struct CellData
-
struct DistributedDomainBCellList
-
struct distributedDomainInfo
-
FireDomain()
-
class FireNode : public libforefire::ForeFireAtom, private libforefire::Visitable
Object constituting the fire front.
FireNode defines the lagrangian tracking particles for the fire front. Their properties are: the location, the normal to the front and the rate of spread. Pointers are setVal to the nextInFront and previous fire nodes of the front. The next location of the node is computed in ‘timeAdvance()’ function overloaded from the ForeFireAtom class. The ‘update()’ function also overloads the virtual function from the ForeFireAtom class and setVal the new properties of the FireNode.
Public Types
-
enum State
state of the firenode
boolean for outputs
Values:
-
enumerator init
-
enumerator moving
-
enumerator merging
-
enumerator splitting
-
enumerator final
-
enumerator link
-
enumerator init
Public Functions
-
FireNode(FireDomain* = 0)
Default constructor.
-
virtual ~FireNode()
Destructor.
-
void initialize(FFPoint&, FFVector&, double&, double&, double = 0., FireDomain* = 0, FireFront* = 0, FireNode* = 0)
Object initialization.
-
FFVector getNormal()
Accessor to the local normal to the front
-
double getSpeed()
Accessor to the rate of spread of the fire front
-
double getFrontDepth()
front depth getter
-
double getCurvature()
curvature getter
-
size_t getPosInFront()
Gives the position in the front relative to the current head
-
void setCurvature(double)
Mutator of the curvature of the front at the marker’s location
-
void setDomain(FireDomain*)
declaration of the containing ‘FireDomain’
-
void setFrontDepth(const double&)
front depth setter
-
void makeTrash()
trashing the node
-
virtual void timeAdvance()
computes the next ‘FireNode’ properties and the time of update. overloads ‘timeAdvance()’ from ‘ForeFireAtom’)
-
virtual void output()
Output function
-
void haloUpdate(FireNodeData*, FireDomain*)
updating the firenode if new information in the halo
-
virtual void accept(Visitor*)
Visitor function
-
void eraseTopology()
erasing topology of a firenode
-
void computeLocalFrontProperties()
computing the front properties at marker location
-
bool assertCompatibleTopology()
asserting that local topology is compatible with properties’ computation
-
FFVector computeNormal()
computing the normal at marker location
-
double computeCurvature()
computing the curvature at marker location
-
void setSplitting()
split related procedures
-
FFPoint locAtTime(double)
approximated location at a given time
-
virtual string toString()
print function
Public Static Functions
-
static void setCurvatureComputation(const int&)
booleans for the computation of the local and global interface properties
-
static void setSmoothing(double)
smoothing in the speed computation
-
static void setRelax(double)
relaxation in the speed computation
-
static void setMinSpeed(double)
minimum speed allowed
Public Static Attributes
-
static NormalScheme nmlScheme = FireNode::medians
normal scheme
-
static CurvatureScheme curvScheme = FireNode::circumradius
curvature scheme
-
enum State
-
class FireFront : public libforefire::ForeFireAtom, private libforefire::Visitable
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.
Public Functions
-
FireFront(FireDomain* = 0)
Default constructor, to be avoided.
boolean for outputs
-
FireFront(const double&, FireDomain*, FireFront* = 0)
Constructor for a front included in a ‘FireDomain’ and a containing front.
-
virtual ~FireFront()
Destructor.
-
FireDomain *getDomain()
Accesssor to the domain.
-
virtual void update()
updates the ‘FireFront’ properties (overloads ‘update()’ from ‘ForeFireAtom’)
-
virtual void timeAdvance()
computes the next ‘FireFront’ properties and the time of update. (overloads ‘timeAdvance()’ from ‘ForeFireAtom’)
-
virtual void output()
Output function
-
virtual void accept(Visitor*)
Visitor function.
-
bool isExpanding()
behavior of th firefront
-
double getArea()
Area of the front.
-
int getNumInnerFronts()
getter of the number of inner fronts
-
void extend()
extending the firefront in one direction
-
void storeVertices(double*, double*, size_t&)
constructing arrays storing the coordinates of the vertices constituting the front
-
bool checkForBurningStatus(FFPoint&)
checking the burning status of a given location
-
void computeBoundingBox(FFPoint&, FFPoint&)
computes a rectangle containing the entire front
-
void increaseNumFN()
managing the number of firenodes in the front
-
void makeTrash()
making the front a trash one
-
virtual string toString()
print function
-
FireFront(FireDomain* = 0)
-
class DataBroker
Data Broker for a fire simulation.
DataBroker implements a data management tool tailored for FireDomain. Several layers of available data are stored and methods to communicate the desired values to the FireDomain are defined. The FireDomain has first registered the properties needed by the propagation model and DataBroker is responsible for accessing these values at given location and time. DataBroker also manages the storing of atmospheric properties (for coupled fire/atmopshere simulations) and parallel-related arrays (for parallel simulations).
Public Functions
-
DataBroker(FireDomain* = 0)
default constructor
-
virtual ~DataBroker()
destructor
-
void registerPropagationModel(PropagationModel*)
registering a propagation model
-
void registerFluxModel(FluxModel*)
registering a flux model
-
void registerFluxLayer(string, FluxLayer<double>*)
registering a flux layer in the data broker
-
void loadFromNCFile(string)
loadFromNCFile function for NetCDF files
-
void readTableFromAsciiFile(string, vector<map<string, double>>&)
reading a table from an ascii file
-
void readTableFromString(const std::string&, vector<map<string, double>>&)
reading a table from an sttring variable
-
void tokenize(const string&, vector<string>&, const string&)
splitting a string according to a delimiter
-
void setAtmosphericDomain(const FFPoint&, const FFPoint&, const size_t&, const size_t&)
initializing the atmospheric layers
-
void insureLayersExistence()
insuring the presence of all needed layers
-
void initFluxLayers(const double&)
initialize flux layers
-
void addConstantLayer(const string&, const string&, const string&, double, const FFPoint &S, const FFPoint&)
default constant layer constructor
-
DataLayer<double> *getLayer(const string&)
typical double layer constructor
accessor to the desired data layer
-
FluxLayer<double> *getFluxLayer(const string&)
accessor to the desired flux layer
-
void computeActiveSurfacesFlux(const double&)
recomputes flux actives surfaces for each model
-
void getPropagationData(PropagationModel*, FireNode*)
accessor to the desired set of properties for propagation models
-
void getFluxData(FluxModel*, FFPoint&, const double&)
accessor to the desired set of properties for flux models
-
void getMatrix(string, const FFPoint&, const FFPoint&, const double&, FFArray<double>**)
accessor to the data contained in the desired layer
-
DataBroker(FireDomain* = 0)
-
template<typename T>
class DataLayer Purely virtual template data layer object.
DataLayer implements common behavior for all data layers
Subclassed by libforefire::FluxLayer< double >, libforefire::PropagativeLayer< double >, libforefire::XYZTDataLayer< double >, libforefire::Array2DdataLayer< T >, libforefire::Array3DdataLayer< T >, libforefire::BurningMapLayer< T >, libforefire::BurningRatioLayer< T >, libforefire::FluxLayer< T >, libforefire::FuelDataLayer< T >, libforefire::GradientDataLayer< T >, libforefire::MultiplicativeLayer< T >, libforefire::PropagativeLayer< T >, libforefire::RosLayer< T >, libforefire::TimeGradientDataLayer< T >, libforefire::TwoTimeArrayLayer< T >, libforefire::WeatherDataLayer< T >, libforefire::XYZTDataLayer< T >
Public Functions
-
inline DataLayer()
Default constructor.
-
inline DataLayer(string name)
Constructor with key.
-
inline string getKey()
getter to the key of the layer
-
inline void setKey(string name)
setter of the key of the layer
-
virtual size_t getValuesAt(FireNode*, PropagationModel*, size_t) = 0
directly stores the desired values in a given array
-
virtual size_t getValuesAt(FFPoint, const double&, FluxModel*, size_t) = 0
directly stores the desired values in a given array
-
virtual void setMatrix(string&, double*, const size_t&, size_t&, const double&) = 0
stores data from a given array
-
virtual string print() = 0
print the related data
-
inline DataLayer()
-
class Command
Commands for driving a ForeFire simulation (singleton class)
Command is a singleton class that defines the entry points for user-defined actions thus enabling driving a ForeFire simulation.
Public Static Functions
-
static void setReferenceTime(const double&)
setting the reference time
-
static void setStartTime(const double&)
setting the start time of the step of simulation
-
static double getTime()
getting the current time of simulation
-
static void increaseLevel()
managing the level
-
static FireDomain *getDomain()
accessor to the domain
-
static void setOstringstream(ostringstream*)
command to redirect the ostringstream
-
static void ExecuteCommand(string&)
execute the desired command
-
static string dumpString()
backup of the simulation
Public Static Attributes
-
static Session currentSession = {SimulationParameters::GetInstance(), 0, 0, 0, 0, 0, 0, 0, &cout, 0, 0,}
session containing all the data of the ForeFire simulation
-
static vector<string> outputDirs
vector of outputs directories
-
struct Session
-
static void setReferenceTime(const double&)
-
class SimulationParameters
Public Static Functions
-
static string FormatISODate(double secs, int year, int yday)
returns an ISO date string from secs, year and day of the year
-
static bool ISODateDecomposition(string date, double &secs, int &year, int &yday)
store into secs, year and yday respectively secs, year and day of the year from an ISO date string
-
static double SecsBetween(double t1, int y1, int yday1, double t2, int y2, int yday2)
returns the number of seconds between two dates
-
static string GetPath(string arg)
returns the correct absolute path from a relative or absolute path
-
static string FormatISODate(double secs, int year, int yday)
-
class Simulator
Class providing control over the simulation.
The ‘Simulator’ class provides methods in order to search through a ‘schedule’ (’TimeTable’ object) and treating events of the simulation one after the other
Public Functions
-
Simulator()
Default constructor.
-
Simulator(TimeTable*, bool = false)
Constructor provided a ‘TimeTable’.
-
virtual ~Simulator()
Default destructor.
-
void goTo(const double&)
Advancing the simulation of the prescribed step.
-
void treatNextEvent()
treating the next event and updating the ‘schedule’
-
Simulator()