3 #ifndef _BCP_VECTOR_CHANGE_H
4 #define _BCP_VECTOR_CHANGE_H
8 #include "CoinHelperFunctions.hpp"
65 const int new_size = nv.
size();
66 const int old_size = ov.
size();
67 const int del_size = del_pos.
size();
69 for (i = 0, j = 0, k = 0; i < old_size && k < del_size; ++i) {
70 if (del_pos[k] == i) {
79 if (old_size - i > new_size - j)
81 old_vec has entries not in new_vec but not listed in del_pos.\n");
82 for ( ; i < old_size; ++i, ++
j) {
88 _values.reserve(change_size + new_size - j);
89 for (i = 0; i < change_size; ++i) {
106 const int new_size = nv.
size();
107 const int old_size = ov.
size();
108 const int del_size = del_pos.
size();
110 for (i = 0, j = 0, k = 0; i < old_size && k < del_size; ++i) {
111 if (del_pos[k] == i) {
115 if (CoinAbs(ov[i] - nv[j]) > etol) {
120 if (old_size - i > new_size - j)
122 old_vec has entries not in new_vec but not listed in del_pos.\n");
123 for ( ; i < old_size; ++i, ++
j) {
124 if (CoinAbs(ov[i] - nv[j]) > etol) {
129 _values.reserve(change_size + new_size - j);
130 for (i = 0; i < change_size; ++i) {
155 BCP_vec_change::explicit_vector() : non-explicit storage!\n");
194 trying to update a non-explicit storage with another non-explicit!\n");
197 for (
int i = 0; i < ch_size; ++i) {
BCP_buffer & pack(const T &value)
Pack a single object of type T.
BCP_buffer & unpack(T &value)
Unpack a single object of type T.
void clear()
Delete every entry.
BCP_vec_change(const T *first, const T *last)
Construct an explicit description describing the vector bounded by the two iterators.
int storage_size() const
Return how much memory it'll take to pack this info.
const BCP_vec< T > & explicit_vector() const
Return a const reference to the vector if it is explicitly stored, otherwise throw an exception...
BCP_vec< int > _del_pos
Empty in case of explicit storage.
BCP_storage_t _storage
The storage type of the the vector.
~BCP_vec_change()
The destructor need not do anything.
void unpack(BCP_buffer &buf)
Unpack the data from a buffer.
void push_back(const_reference x)
Append x to the end of the vector.
The data stored is an explicit listing of values.
This class stores a vector explicitly or relatively to another vector.
BCP_vec_change(BCP_buffer &buf)
Construct the object by unpacking it from a buffer.
BCP_vec_change(const BCP_storage_t st)
Construct a vector change that's empty and is of the given storage.
The data stored is with respect to the same kind of data in the parent of the search tree node...
BCP_storage_t storage() const
Return the storage type of the vector.
void update(const BCP_vec_change< T > &change)
Update the current vector with the argument vector.
BCP_vec< T > _values
In case of explicit storage these are the values in the vector.
Currently there isn't any error handling in BCP.
BCP_vec< int > _change_pos
Empty in case of explicit storage.
size_t size() const
Return the current number of entries.
iterator end()
Return an iterator to the end of the object.
BCP_vec_change(const BCP_vec_change< T > &old_vec, const BCP_vec_change< T > &new_vec, const BCP_vec< int > &del_pos, const double etol)
Construct a relative description.
This class describes the message buffer used for all processes of BCP.
BCP_storage_t
This enumerative constant describes how to store certain data for a search tree node.
iterator entry(const int i)
Return an iterator to the i-th entry.
void pack(BCP_buffer &buf) const
Pack the data into a buffer.
BCP_vec_change(const BCP_vec_change< T > &old_vec, const BCP_vec_change< T > &new_vec, const BCP_vec< int > &del_pos)
Construct a relative description.