atom_concept.hpp

Go to the documentation of this file.
00001 // -*- mode: c++; indent-tabs-mode: nil; -*-
00002 //
00003 //The Biomolecule Toolkit (BTK) is a C++ library for use in the
00004 //modeling, analysis, and design of biological macromolecules.
00005 //Copyright (C) 2006, Tim Robertson <kid50@users.sourceforge.net>
00006 //
00007 //This program is free software; you can redistribute it and/or modify
00008 //it under the terms of the GNU Lesser General Public License as published
00009 //by the Free Software Foundation; either version 2.1 of the License, or (at
00010 //your option) any later version.
00011 //
00012 //This program is distributed in the hope that it will be useful,  but
00013 //WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //Lesser General Public License for more details.
00016 //
00017 //You should have received a copy of the GNU Lesser General Public License
00018 //along with this program; if not, write to the Free Software Foundation,
00019 //Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020 
00023 
00024 #ifndef BTK_CONCEPTS_ATOM_CONCEPT_HPP
00025 #define BTK_CONCEPTS_ATOM_CONCEPT_HPP
00026 
00050 
00229 
00230 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00231 
00232 #include <string>
00233 #include <iostream>
00234 
00235 #include <boost/concept_check.hpp>
00236 
00237 #include <btk/core/concepts/chemically_typed_concept.hpp>
00238 #include <btk/core/math/btk_vector.hpp>
00239 
00240 namespace BTK {
00241 namespace CONCEPTS {
00242 
00243 template <class T>
00244 struct AtomConcept
00245 {
00246   typedef typename T::atom_id_type at;
00247   typedef typename T::element_id_type et;
00248   typedef typename T::chemical_type_system cts_t;
00249 
00250   void constraints() {
00251     boost::function_requires<boost::DefaultConstructibleConcept<T> >();
00252     boost::function_requires<boost::CopyConstructibleConcept<T> >();
00253     boost::function_requires<boost::EqualityComparableConcept<T> >();
00254     boost::function_requires<boost::AssignableConcept<T> >();
00255     boost::function_requires<ChemicallyTypedConcept<T> >();
00256 
00257     // construct from position, type ids, number and dictionary
00258     T atom2(pos,atom_type,element_type,atom_num,cts);
00259 
00260     atom.set_element_type(element_type);
00261     atom.set_position(pos);
00262     atom.set_number(atom_num);
00263 
00264     const_constraints(atom);
00265   }
00266 
00267   void const_constraints(T const & atom) {
00268     element_type = atom.element_type();
00269     pos = atom.position();
00270     atom_num = atom.number();
00271 
00272     s = atom.selected();
00273     atom.select(s);
00274 
00275     std::cout << atom.print(std::cout);
00276     std::cout << atom.print(std::cout,
00277                             atom_num,
00278                             group_num,
00279                             chain_id,
00280                             group_name);
00281   }
00282 
00283   T atom;
00284   BTK::MATH::BTKVector pos;
00285   at atom_type;
00286   et element_type;
00287   bool s;
00288   int atom_num, group_num;
00289   std::string atom_name, group_name;
00290   char chain_id;
00291   cts_t cts;
00292 };
00293 
00294 } // namespace CONCEPTS
00295 } // namespace BTK
00296 
00297 #endif // DOXYGEN_SHOULD_SKIP_THIS
00298 
00299 #endif // BTK_CONCEPTS_ATOM_CONCEPT_HPP

Generated on Sun Jul 15 20:46:24 2007 for BTK Core by  doxygen 1.5.1