Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

colvar_grid_count Class Reference

Colvar_grid derived class to hold counters in discrete n-dim colvar space. More...

#include <colvargrid.h>

Inheritance diagram for colvar_grid_count:

colvar_grid< size_t > colvarparse List of all members.

Public Member Functions

 colvar_grid_count ()
 Default constructor.
virtual ~colvar_grid_count ()
 Destructor.
 colvar_grid_count (std::vector< int > const &nx_i, size_t const &def_count=0)
 Constructor.
 colvar_grid_count (std::vector< colvar * > &colvars, size_t const &def_count=0)
 Constructor from a vector of colvars.
void incr_count (std::vector< int > const &ix)
 Increment the counter at given position.
size_t const & new_count (std::vector< int > const &ix, size_t const &imult=0)
 Get the binned count indexed by ix from the newly read data.
std::istream & read_restart (std::istream &is)
 Read the grid from a restart.
std::ostream & write_restart (std::ostream &os)
 Write the grid to a restart.
virtual void value_input (std::vector< int > const &ix, size_t const &t, size_t const &imult=0, bool add=false)
 Get the value from a formatted output and transform it into the internal representation (it may have been rescaled or manipulated).

Detailed Description

Colvar_grid derived class to hold counters in discrete n-dim colvar space.

Definition at line 780 of file colvargrid.h.


Constructor & Destructor Documentation

colvar_grid_count::colvar_grid_count  ) 
 

Default constructor.

Definition at line 11 of file colvargrid.C.

00012   : colvar_grid<size_t>()
00013 {}

virtual colvar_grid_count::~colvar_grid_count  )  [inline, virtual]
 

Destructor.

Definition at line 788 of file colvargrid.h.

00789   {}

colvar_grid_count::colvar_grid_count std::vector< int > const &  nx_i,
size_t const &  def_count = 0
 

Constructor.

Definition at line 15 of file colvargrid.C.

00017   : colvar_grid<size_t> (nx_i, def_count)
00018 {}

colvar_grid_count::colvar_grid_count std::vector< colvar * > &  colvars,
size_t const &  def_count = 0
 

Constructor from a vector of colvars.

Definition at line 20 of file colvargrid.C.

00022   : colvar_grid<size_t> (colvars, def_count)
00023 {}


Member Function Documentation

void colvar_grid_count::incr_count std::vector< int > const &  ix  )  [inline]
 

Increment the counter at given position.

Definition at line 800 of file colvargrid.h.

References colvar_grid< size_t >::address().

Referenced by colvar_grid_gradient::acc_force(), colvar_grid_gradient::acc_grad(), colvar_grid_scalar::acc_value(), and colvarbias_histogram::update().

00801   {
00802     ++(data[this->address (ix)]);
00803   }

size_t const& colvar_grid_count::new_count std::vector< int > const &  ix,
size_t const &  imult = 0
[inline]
 

Get the binned count indexed by ix from the newly read data.

Definition at line 806 of file colvargrid.h.

References colvar_grid< size_t >::address().

Referenced by colvar_grid_gradient::value_input(), and colvar_grid_scalar::value_input().

00808   {
00809     return new_data[address (ix) + imult];
00810   }

std::istream & colvar_grid_count::read_restart std::istream &  is  ) 
 

Read the grid from a restart.

Definition at line 25 of file colvargrid.C.

References colvarmodule::log(), colvar_grid< size_t >::parse_params(), and colvar_grid< size_t >::read_raw().

00026 {
00027   size_t const start_pos = is.tellg();
00028   std::string key, conf;
00029   if ((is >> key) && (key == std::string ("grid_parameters"))) {
00030     is.seekg (start_pos, std::ios::beg);
00031     is >> colvarparse::read_block ("grid_parameters", conf);
00032     parse_params (conf);
00033   } else {
00034     cvm::log ("Grid parameters are missing in the restart file, using those from the configuration.\n");
00035     is.seekg (start_pos, std::ios::beg);
00036   }
00037   read_raw (is);
00038   return is;
00039 }

virtual void colvar_grid_count::value_input std::vector< int > const &  ix,
size_t const &  t,
size_t const &  imult = 0,
bool  add = false
[inline, virtual]
 

Get the value from a formatted output and transform it into the internal representation (it may have been rescaled or manipulated).

Reimplemented from colvar_grid< size_t >.

Definition at line 821 of file colvargrid.h.

References colvar_grid< size_t >::address().

00825   {
00826     if (add) {
00827       data[address (ix)] += t;
00828       if (this->has_parent_data) {
00829         // save newly read data for inputting parent grid
00830         new_data[address (ix)] = t;
00831       }
00832     } else {
00833       data[address (ix)] = t;
00834     }
00835   }

std::ostream & colvar_grid_count::write_restart std::ostream &  os  ) 
 

Write the grid to a restart.

Definition at line 41 of file colvargrid.C.

References colvar_grid< size_t >::write_params(), and colvar_grid< size_t >::write_raw().

00042 {
00043   write_params (os);
00044   write_raw (os);
00045   return os;
00046 }


The documentation for this class was generated from the following files:
Generated on Mon Nov 23 04:59:33 2009 for NAMD by  doxygen 1.3.9.1