EPANET  3.0
EPANET Development Project
segpool.h
Go to the documentation of this file.
1 /* EPANET 3
2  *
3  * Copyright (c) 2016 Open Water Analytics
4  * Licensed under the terms of the MIT License (see the LICENSE file for details).
5  *
6  */
7 
10 
11 #ifndef SEGPOOL_H_
12 #define SEGPOOL_H_
13 
14 class MemPool;
15 
16 struct Segment
17 {
18  double v;
19  double c;
20  struct Segment* next;
21 };
22 
23 class SegPool
24 {
25  public:
26  SegPool();
27  ~SegPool();
28  void init();
29  Segment* getSegment(double v, double c);
30  void freeSegment(Segment* seg);
31 
32  private:
33  int segCount; // number of volume segments allocated
34  Segment* freeSeg; // first unused segment
35  MemPool* memPool; // memory pool for volume segments
36 };
37 
38 #endif // SEGPOOL_H_
Definition: segpool.h:23
double v
volume (ft3)
Definition: segpool.h:18
A simple pooled memory allocator.
Definition: mempool.h:21
struct Segment * next
next upstream volume segment
Definition: segpool.h:20
double c
constituent concentration (mass/ft3)
Definition: segpool.h:19
< Volume segment
Definition: segpool.h:16