ConstraintSet.h 1.88 KB
Newer Older
1 2
////////////////////////////////////////////////////////////////////////////////
//
Francois Gygi committed
3 4 5 6
// Copyright (c) 2008 The Regents of the University of California
//
// This file is part of Qbox
//
Francois Gygi committed
7 8
// Qbox is distributed under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 2 of
Francois Gygi committed
9 10 11 12 13 14
// the License, or (at your option) any later version.
// See the file COPYING in the root directory of this distribution
// or <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////
//
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
// ConstraintSet.h
//
////////////////////////////////////////////////////////////////////////////////

#ifndef CONSTRAINTSET_H
#define CONSTRAINTSET_H

#include <vector>
#include <string>

class Atom;
class AtomSet;
class Constraint;
class Context;

class ConstraintSet
{
  private:
33

34
  const Context& ctxt_;
35
  std::vector<Constraint *> constraint_list;
36 37
  // ndofs_: total number of degrees of freedom blocked by the constraints
  int ndofs_;
38

39 40
  public:

41
  ConstraintSet(const Context& ctxt) : ctxt_(ctxt), ndofs_(0) {}
42
  ~ConstraintSet();
Francois Gygi committed
43 44 45
  bool define_constraint(AtomSet &atoms, int argc, char **argv);
  bool set_constraint(int argc, char **argv);
  bool delete_constraint(int argc, char **argv);
46
  void list_constraints(std::ostream &os);
47
  int size(void) const { return constraint_list.size(); }
48
  int ndofs(void) const { return ndofs_; }
49
  void enforce(AtomSet& atoms);
50 51 52 53 54 55
  void enforce_r(const std::vector<std::vector<double> > &r0,
                 std::vector<std::vector<double> > &rp);
  void enforce_v(const std::vector<std::vector<double> > &r0,
                 std::vector<std::vector<double> > &v0);
  void compute_forces(const std::vector<std::vector<double> > &r0,
                      const std::vector<std::vector<double> > &f);
56 57
  void update_constraints(double dt);
  void setup(AtomSet& atoms);
Francois Gygi committed
58
  void reset(void);
59 60
};
#endif