git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@13207 f3b2605a-c512-4ea7-a41b-209d697bcdaa

This commit is contained in:
sjplimp
2015-03-09 14:50:53 +00:00
parent 08e77a79b3
commit 5a0a8f1335
11 changed files with 118 additions and 61 deletions

View File

@ -171,27 +171,31 @@ public:
/// Set the type explicitly
inline void type(Type const &vti)
{
// reset the value based on the previous type
reset();
if ((value_type == type_vector) && (vti != type_vector)) {
vector1d_value.resize(0);
if (vti != value_type) {
// reset the value based on the previous type
reset();
if ((value_type == type_vector) && (vti != type_vector)) {
vector1d_value.resize(0);
}
value_type = vti;
}
value_type = vti;
}
/// Set the type after another \link colvarvalue \endlink
inline void type(colvarvalue const &x)
{
// reset the value held from based on the previous type
reset();
if (x.type() == type_vector) {
vector1d_value.resize(x.vector1d_value.size());
} else {
if (x.type() != value_type) {
// reset the value based on the previous type
reset();
if (value_type == type_vector) {
vector1d_value.resize(0);
}
value_type = x.type();
}
if (x.type() == type_vector) {
vector1d_value.resize(x.vector1d_value.size());
}
value_type = x.type();
}
/// Make the type a derivative of the original type