#include </usr1/tp517/Tumble/trunk/src/tumble/datastore.h>
Collaboration diagram for DataStore:
Public Member Functions | |
DataStore (PersistantStore &) | |
~DataStore () | |
ControlPoint | add_cp (const Point2D &p) |
Adds a new ControlPoint to the CellComplex's set. | |
void | rem_cp (ControlPoint cp) |
Removes the ControlPoint from the CellComplex's set. | |
DataPoint | add_dp (ControlPoint cp, const LinearData &data) |
Adds the DataPoint to the CellComplex's data set. | |
void | rem_dp (ControlPoint cp, DataPoint dp) |
Removes the DataPoint from the CellComplex's data set. | |
void | replace_cp (const ControlPoint &old_cp, const ControlPoint &new_cp) |
Replace any use of the old control point with the new. The old_cp is invalidated by this operation. | |
DataPoint | operator[] (const ControlPoint &cp) const |
void | replace_dp (const ControlPoint &cp, const LinearData &new_ld) |
DataPoint | get_data (const ControlPoint &) const |
bool | has_data (const ControlPoint &) const |
unsigned | num_control_points () const |
unsigned | num_data_points () const |
unsigned | data_length () const |
void | add_channels (unsigned num_new_channels) |
Add channels of data to every LinearData in storage. | |
void | print () const |
Print info. | |
void | write_geo_into (unsigned indexX, unsigned indexY) |
Copy geometric position (x,y) into data channels indexX and indexY. | |
void | read_geo_from (unsigned indexX, unsigned indexY) |
Copy data into the geometric position (x,y). | |
void | swap_geo_with (unsigned indexX, unsigned indexY) |
Copy data into the geometric position (x,y). | |
void | copy_data (unsigned indexFrom, unsigned indexTo) |
Copy data from one channel to another. | |
void | copy_data_2 (unsigned indexAx, unsigned indexAy, unsigned indexBx, unsigned indexBy) |
Copy data from two channels (Ax,Ay) to two others (Bx,By). | |
void | swap_data (unsigned indexFrom, unsigned indexTo) |
Swap data between one channel and another. | |
void | swap_data_2 (unsigned indexAx, unsigned indexAy, unsigned indexBx, unsigned indexBy) |
Swap data between two channels (Ax,Ay) and two others (Bx,By). | |
void | write_geo_into (unsigned indexV) |
void | read_geo_from (unsigned indexV) |
void | swap_geo_with (unsigned indexV) |
void | copy_data_2 (unsigned indexAv, unsigned indexBv) |
void | swap_data_2 (unsigned indexAv, unsigned indexBv) |
Private Types | |
typedef PersistantHashMap< ControlPoint, DataPoint, ControlPointHasher > | Data_Hash_T |
Private Member Functions | |
DataStore (const DataStore &other) | |
Destructor. | |
const DataStore | operator= (const DataStore &other) |
Private Attributes | |
Data_Hash_T | data_hash |
Mapping from ControlPoints to DataPoints. | |
PersistantList< Point2D > | control_points |
Container for ControlPoints. | |
PersistantList< LinearData > | data_points |
Container for DataPoints. | |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const DataStore &ds) |
Print info to stream. |
This class acts as the storage facility for the geometric (Point2D), and functional (LinearData) data of a BezierMesh / BoundaryMesh pair.
Since both meshes are using the same data, it does not make sense for one or the other to hold the data. Additionally, it does not make sense to hold the data in a CellComplex, as this should hold topological data only. Furthermore, the data cannot be held in a global location, as this prevents more than one mesh instance to exist at a time. Thus, the need for the DataStore as a neutral class to manage both the geometric and functional data, as well as maintain the mapping between them
Overall the DataStore class is not very smart, determining when to add/remove data is done by the BezierMesh and BoundaryMesh classes, the DataStore just acts as a neutral third party.
BoundaryMeshs are responsable for adding/removing all ContolPoints that correspond to a BoundaryVertex or BoundaryEdge. This is so that a BoundaryMesh can exist geometrically without Bezier elements being defined.
BezierMeshs are responsible for adding/removing all other ControlPoints, and all DataPoints regardless of whether they are on the boundary or not.
The average user should not have to add/remove data manually, as the Mesh classes will take care of that. The user may however wish to iterate over the ControlPoints or DataPoints, or make use of the data_hash which maps ControlPoints to thier cooresponding DataPoints.
Definition at line 41 of file datastore.h.
typedef PersistantHashMap<ControlPoint,DataPoint,ControlPointHasher> DataStore::Data_Hash_T [private] |
Definition at line 109 of file datastore.h.
DataStore::DataStore | ( | PersistantStore & | ) |
Definition at line 14 of file datastore.C.
DataStore::~DataStore | ( | ) | [inline] |
Definition at line 45 of file datastore.h.
DataStore::DataStore | ( | const DataStore & | other | ) | [private] |
Destructor.
ControlPoint DataStore::add_cp | ( | const Point2D & | p | ) |
Adds a new ControlPoint to the CellComplex's set.
p | The Point2D value of the new ControlPoint |
Definition at line 23 of file datastore.C.
References control_points.
Referenced by BezierMesh::add_bezier_edge(), BezierMesh::add_bezier_vertex(), BoundaryMesh::add_boundary_vertex(), and QBSpline::add_knot().
void DataStore::rem_cp | ( | ControlPoint | cp | ) |
Removes the ControlPoint from the CellComplex's set.
cp | The ControlPoint to remove |
Definition at line 33 of file datastore.C.
References control_points.
Referenced by BoundaryMesh::delete_edge(), BezierMesh::delete_edge(), BoundaryMesh::delete_vertex(), BezierMesh::delete_vertex(), QBSpline::remove_knot(), and replace_cp().
DataPoint DataStore::add_dp | ( | ControlPoint | cp, | |
const LinearData & | d | |||
) |
Adds the DataPoint to the CellComplex's data set.
cp | The ContolPoint to be assoicated with | |
d | The LinearData to add as a new DataPoint |
Definition at line 44 of file datastore.C.
References data_hash, and data_points.
Referenced by BezierMesh::add_bezier_edge(), BezierMesh::add_bezier_vertex(), and replace_dp().
void DataStore::rem_dp | ( | ControlPoint | cp, | |
DataPoint | dp | |||
) |
Removes the DataPoint from the CellComplex's data set.
cp | The ContolPoint associated with the DataPoint | |
dp | The DataPoint to remove |
Definition at line 59 of file datastore.C.
References data_hash, and data_points.
Referenced by BezierMesh::delete_edge(), BezierMesh::delete_vertex(), and replace_dp().
void DataStore::replace_cp | ( | const ControlPoint & | old_cp, | |
const ControlPoint & | new_cp | |||
) |
Replace any use of the old control point with the new. The old_cp is invalidated by this operation.
If the old_cp had a data pointer, copy it over to the new_cp (which must not have data). Then remove old_cp.
Definition at line 72 of file datastore.C.
References data_hash, has_data(), and rem_cp().
Referenced by BezierMesh::replace_control_point().
Here is the call graph for this function:
DataPoint DataStore::operator[] | ( | const ControlPoint & | cp | ) | const [inline] |
Definition at line 61 of file datastore.h.
References get_data().
Here is the call graph for this function:
void DataStore::replace_dp | ( | const ControlPoint & | cp, | |
const LinearData & | new_ld | |||
) |
Definition at line 86 of file datastore.C.
References add_dp(), get_data(), and rem_dp().
Referenced by add_channels().
Here is the call graph for this function:
DataPoint DataStore::get_data | ( | const ControlPoint & | ) | const |
Definition at line 95 of file datastore.C.
References data_hash.
Referenced by BezierMesh::add_bezier_edge(), add_channels(), BezierMesh::function_angle(), Simulation::get_data(), operator[](), read_geo_from(), replace_dp(), swap_geo_with(), and write_geo_into().
bool DataStore::has_data | ( | const ControlPoint & | ) | const |
unsigned DataStore::num_control_points | ( | ) | const |
unsigned DataStore::num_data_points | ( | ) | const |
unsigned DataStore::data_length | ( | ) | const |
Definition at line 117 of file datastore.C.
References data_points.
Referenced by add_channels(), copy_data(), copy_data_2(), BezierMesh::data_length(), read_geo_from(), swap_data(), swap_data_2(), swap_geo_with(), and write_geo_into().
void DataStore::add_channels | ( | unsigned | num_new_channels | ) |
Add channels of data to every LinearData in storage.
num_new_channels | the number of new channels to add |
Definition at line 130 of file datastore.C.
References control_points, data_length(), get_data(), replace_dp(), and LinearData::set().
Here is the call graph for this function:
void DataStore::print | ( | ) | const |
Print info.
Definition at line 310 of file datastore.C.
Referenced by Simulation::print_statistics().
void DataStore::write_geo_into | ( | unsigned | indexX, | |
unsigned | indexY | |||
) |
Copy geometric position (x,y) into data channels indexX and indexY.
indexX | The index of the data channel to copy the x geometry into | |
indexY | The index of the data channel to copy the y geometry into |
Definition at line 161 of file datastore.C.
References control_points, data_length(), and get_data().
Referenced by Simulation::store_state(), and write_geo_into().
Here is the call graph for this function:
void DataStore::read_geo_from | ( | unsigned | indexX, | |
unsigned | indexY | |||
) |
Copy data into the geometric position (x,y).
indexX | The index of the data channel to copy the x geometry from | |
indexY | The index of the data channel to copy the y geometry from |
Definition at line 181 of file datastore.C.
References control_points, data_length(), and get_data().
Referenced by read_geo_from(), and Simulation::restore_state().
Here is the call graph for this function:
void DataStore::swap_geo_with | ( | unsigned | indexX, | |
unsigned | indexY | |||
) |
Copy data into the geometric position (x,y).
indexX | The index of the data channel to copy the x geometry from | |
indexY | The index of the data channel to copy the y geometry from |
Definition at line 200 of file datastore.C.
References control_points, data_length(), and get_data().
Referenced by Simulation::move(), Simulation::move_safe(), and swap_geo_with().
Here is the call graph for this function:
void DataStore::copy_data | ( | unsigned | indexFrom, | |
unsigned | indexTo | |||
) |
Copy data from one channel to another.
indexFrom | The index of the channel to copy from | |
indexTo | The index of the channel to copy to |
Definition at line 225 of file datastore.C.
References data_length(), and data_points.
Here is the call graph for this function:
void DataStore::copy_data_2 | ( | unsigned | indexAx, | |
unsigned | indexAy, | |||
unsigned | indexBx, | |||
unsigned | indexBy | |||
) |
Copy data from two channels (Ax,Ay) to two others (Bx,By).
indexAx | x channel of the "from" pair | |
indexAy | y channel of the "from" pair | |
indexBx | x channel of the "to" pair | |
indexBy | y channel of the "to" pair |
Definition at line 243 of file datastore.C.
References data_length(), and data_points.
Referenced by copy_data_2(), Simulation::restore_state(), and Simulation::store_state().
Here is the call graph for this function:
void DataStore::swap_data | ( | unsigned | indexA, | |
unsigned | indexB | |||
) |
Swap data between one channel and another.
indexA | Index of the channel to swap | |
indexB | Index of the channel to swap |
Definition at line 262 of file datastore.C.
References data_length(), and data_points.
Here is the call graph for this function:
void DataStore::swap_data_2 | ( | unsigned | indexAx, | |
unsigned | indexAy, | |||
unsigned | indexBx, | |||
unsigned | indexBy | |||
) |
Swap data between two channels (Ax,Ay) and two others (Bx,By).
indexAx | x channel of the first pair | |
indexAy | y channel of the first pair | |
indexBx | x channel of the second pair | |
indexBy | y channel of the second pair |
Definition at line 283 of file datastore.C.
References data_length(), and data_points.
Referenced by swap_data_2().
Here is the call graph for this function:
void DataStore::write_geo_into | ( | unsigned | indexV | ) | [inline] |
Definition at line 93 of file datastore.h.
References write_geo_into().
Here is the call graph for this function:
void DataStore::read_geo_from | ( | unsigned | indexV | ) | [inline] |
Definition at line 94 of file datastore.h.
References read_geo_from().
Here is the call graph for this function:
void DataStore::swap_geo_with | ( | unsigned | indexV | ) | [inline] |
Definition at line 95 of file datastore.h.
References swap_geo_with().
Here is the call graph for this function:
void DataStore::copy_data_2 | ( | unsigned | indexAv, | |
unsigned | indexBv | |||
) | [inline] |
Definition at line 96 of file datastore.h.
References copy_data_2().
Here is the call graph for this function:
void DataStore::swap_data_2 | ( | unsigned | indexAv, | |
unsigned | indexBv | |||
) | [inline] |
Definition at line 100 of file datastore.h.
References swap_data_2().
Here is the call graph for this function:
std::ostream& operator<< | ( | std::ostream & | stream, | |
const DataStore & | ds | |||
) | [friend] |
Data_Hash_T DataStore::data_hash [private] |
Mapping from ControlPoints to DataPoints.
Definition at line 111 of file datastore.h.
Referenced by add_dp(), get_data(), has_data(), operator<<(), rem_dp(), and replace_cp().
PersistantList<Point2D> DataStore::control_points [private] |
Container for ControlPoints.
Definition at line 113 of file datastore.h.
Referenced by add_channels(), add_cp(), num_control_points(), operator<<(), read_geo_from(), rem_cp(), swap_geo_with(), and write_geo_into().
PersistantList<LinearData> DataStore::data_points [private] |
Container for DataPoints.
Definition at line 114 of file datastore.h.
Referenced by add_dp(), copy_data(), copy_data_2(), data_length(), num_data_points(), operator<<(), rem_dp(), swap_data(), and swap_data_2().