Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MoveMap.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file core/kinematics/MoveMap.cc
11 /// @brief Move map
12 /// @author Phil Bradley
13 /// @author Christopher Miles (cmiles@uw.edu)
14 /// @author Roland A. Pache
15 
16 // Unit headers
18 
19 // Package headers
20 #include <core/id/DOF_ID.hh>
21 #include <core/id/TorsionID.hh>
22 
23 // C++ headers
24 // AUTO-REMOVED #include <iterator>
25 // AUTO-REMOVED #include <utility>
26 #include <vector>
27 
28 // Objexx headers
29 #include <ObjexxFCL/format.hh>
30 
31 // Utility headers
32 #include <utility/PyAssert.hh>
33 #include <utility/io/izstream.hh>
34 #include <utility/string_util.hh>
35 
36 #include <utility/vector1.hh>
37 
38 
39 using namespace ObjexxFCL;
40 using namespace ObjexxFCL::fmt;
41 
42 namespace core {
43 namespace kinematics {
44 
45 /// @details Auto-generated virtual destructor
46 MoveMap::~MoveMap() {}
47 
48 void MoveMap::set_ranges_unmodifiable(const std::vector<std::pair<Size, Size> >& ranges) {
49  using std::pair;
50  using std::vector;
51 
52  set_bb(true);
53  vector<pair<Size, Size> >::const_iterator i;
54  for (i = ranges.begin(); i != ranges.end(); ++i) {
55  Size begin = i->first;
56  Size end = i->second;
57 
58  assert(begin > 0);
59  assert(end > 0);
60  assert(begin <= end);
61 
62  for (Size i = begin; i <= end; ++i) set_bb(i, false);
63  }
64 }
65 
66 ///////////////////////////////////////////////////////////////////////////////
67 /// @details all internal map data are cleared.
68 void
69 MoveMap::clear()
70 {
71  torsion_type_map_.clear();
72  move_map_torsion_id_map_.clear();
73  torsion_id_map_.clear();
74 
75  dof_type_map_.clear();
76  dof_id_map_.clear();
77 
78  jump_id_map_.clear();
79 }
80 
81 /// set/get for JumpIDs --- fold-tree independent definition of jumps
82 void
83 MoveMap::set_jump( id::JumpID const & jump, bool const setting ) {
84  jump_id_map_[ jump ] = setting;
85 }
86 
87 ///////////////////////////////////////////////////////////////////////////////
88 ///@details set a specific TorsionType movable or not, eg "CHI"
89 /// setting this TorsionType will clear data for individual MoveMapTorsionID and
90 /// TorsionID with this TorsionType to keep these three maps in sync. Then query
91 /// for a specific TorsionID or MoveMapTorsionID will turn to setting for TorsionType.
92 void
93 MoveMap::set( TorsionType const & t, bool const setting )
94 {
95  torsion_type_map_[t] = setting;
96 
97  { // map by movemaptorsionid
98  std::vector< MoveMapTorsionID > l;
99 
100  for ( MoveMapTorsionID_Map::const_iterator
101  it=move_map_torsion_id_map_.begin(), it_end = move_map_torsion_id_map_.end(); it != it_end; ++it ) {
102  // bad -- assumes knowledge of MoveMapTorsionID implementation as std::pair
103  // but a whole object is probably overkill
104  // compiler will catch type mismatch here
105  if ( it->first.second == t ) l.push_back( it->first );
106  }
107 
108  for ( std::vector< MoveMapTorsionID >::const_iterator it=l.begin(), it_end=l.end(); it != it_end; ++it ) {
109  move_map_torsion_id_map_.erase( move_map_torsion_id_map_.find( *it ) );
110  }
111  }
112 
113  { // map by torsionid
114  std::vector< TorsionID > l;
115  for ( TorsionID_Map::const_iterator
116  it=torsion_id_map_.begin(), it_end = torsion_id_map_.end(); it != it_end; ++it ) {
117  if ( it->first.type() == t ) l.push_back( it->first );
118  }
119 
120  for ( std::vector< TorsionID >::const_iterator it=l.begin(), it_end=l.end(); it != it_end; ++it ) {
121  torsion_id_map_.erase( torsion_id_map_.find( *it ) );
122  }
123  }
124 
125  // clear the map of JumpIDs
126  if ( t == id::JUMP ) {
127  jump_id_map_.clear();
128  }
129 }
130 
131 ///////////////////////////////////////////////////////////////////////////////
132 ///@details set TorsionType flexible or fixed for one residue, eg BB torsions for residue 10
133 /// setting this MoveMapTorsionID will clear data for individual TorsionID for this residue
134 /// with this TorsionType.
135 void
136 MoveMap::set( MoveMapTorsionID const & id, bool const setting )
137 {
138  //
139  move_map_torsion_id_map_[ id ] = setting;
140 
141  { // map by torsionid
142  Size const seqpos( id.first );
143  TorsionType const & torsion_type( id.second );
144  std::vector< TorsionID > l;
145  for ( TorsionID_Map::const_iterator
146  it=torsion_id_map_.begin(), it_end = torsion_id_map_.end(); it != it_end; ++it ) {
147  if ( it->first.type() == torsion_type && it->first.rsd() == seqpos ) l.push_back( it->first );
148  }
149 
150  for ( std::vector< TorsionID >::const_iterator it=l.begin(), it_end=l.end(); it != it_end; ++it ) {
151  torsion_id_map_.erase( torsion_id_map_.find( *it ) );
152  }
153  }
154 }
155 
156 ///////////////////////////////////////////////////////////////////////////////
157 ///@details set an individual Torsion movable or now, eg, "BB torsion 2 of residue 4"
158 void
159 MoveMap::set( TorsionID const & id, bool const setting )
160 {
161  //
162  torsion_id_map_[ id ] = setting;
163 
164 }
165 
166 ///////////////////////////////////////////////////////////////////////////////
167 // the next two routines are identical between MoveMap and DOF_ID_Mask
168 //
169 // should think about how these two classes are related
170 //
171 // the thing is, the interface to this common data (dof-maps) is slightly
172 // different on the access side...
173 //
174 ///@details brief set for this type of DOF, eg "PHI"
175 /// setting this DOF type will also clear setting for individual DOF_ID of
176 /// this type in order to keep these two maps in sync,(query DOF_ID setting
177 /// will turn to DOF_type setting now)
178 void
179 MoveMap::set(
180  DOF_Type const & t,
181  bool const setting
182 )
183 {
184  dof_type_map_[ t ] = setting;
185 
186  // now have to erase all the individual settings of this type, since
187  // they are obliterated by this call
188  std::vector< DOF_ID > l;
189  for ( DOF_ID_Map::const_iterator it=dof_id_map_.begin(),
190  it_end=dof_id_map_.end(); it != it_end; ++it ) {
191  if ( it->first.type() == t ) {
192  l.push_back( it->first );
193  }
194  }
195 
196  for ( std::vector< DOF_ID >::const_iterator it=l.begin(), it_end=l.end();
197  it != it_end; ++it ) {
198  dof_id_map_.erase( dof_id_map_.find( *it ) );
199  }
200 
201 }
202 
203 ///////////////////////////////////////////////////////////////////////////////
204 ///@details set for an individual dof, eg "PHI of Atom 3 in Residue 5"
205 void
206 MoveMap::set(
207  DOF_ID const & id,
208  bool const setting
209 )
210 {
211  if ( get(id) == setting ) return;
212 
213  dof_id_map_[ id ] = setting;
214 
215 }
216 
217 bool
218 MoveMap::get_jump( id::JumpID const & jump ) const {
219  JumpID_Map::const_iterator jid = jump_id_map_.find( jump );
220  if ( jid != jump_id_map_.end() ) {
221  return jid->second;
222  } else { //return global setting
223  return get( id::JUMP );
224  }
225 }
226 
227 ///////////////////////////////////////////////////////////////////////////////
228 ///@details get setting for a specific TorsionType, such as "BB"
229 /// return false if no setting has been set for this TorsionType.
230 bool
231 MoveMap::get( TorsionType const & t ) const
232 {
233  TorsionTypeMap::const_iterator i = torsion_type_map_.find( t );
234  if ( i == torsion_type_map_.end() ) {
235  return false;
236  }
237  return i->second;
238 }
239 
240 ///////////////////////////////////////////////////////////////////////////////
241 ///@details get TorsionType flexible or fixed for one residue, eg BB torsions for residue 10
242 /// if no setting for this MoveMapTorsionID, use the setting for the TorsionType
243 /// to which this MoveMapTorsionID belongs to.
244 bool
245 MoveMap::get( MoveMapTorsionID const & id ) const
246 {
247  MoveMapTorsionID_Map::const_iterator i = move_map_torsion_id_map_.find( id );
248  if ( i == move_map_torsion_id_map_.end() ) {
249  TorsionType const & t( id.second );
250  return get( t );
251  }
252  return i->second;
253 }
254 
255 ///////////////////////////////////////////////////////////////////////////////
256 ///@details get an individual torsion movable or not, eg BB torsion 2 of residue 4
257 /// if no setting for this specific TorsionID, use setting for the MoveMapTorsionID.
258 /// eg, no setting for BB torsion 2 of residue 4, check setting for BB torsions of
259 /// residue 4; if still not set, use setting for BB torsion type.
260 bool
261 MoveMap::get( TorsionID const & id ) const
262 {
263  if ( !id.valid() ) return false;
264 
265  TorsionID_Map::const_iterator i = torsion_id_map_.find( id );
266  if ( i == torsion_id_map_.end() ) {
267  MoveMapTorsionID const move_map_torsion_id( id.rsd(), id.type() );
268  return get( move_map_torsion_id );
269  }
270  return i->second;
271 }
272 
273 ///@details get setting for this type of DOF, eg "PHI"
274 /// return false if no setting has been set to this DOF_type
275 bool
276 MoveMap::get(
277  DOF_Type const & type
278 ) const
279 {
280  DOF_TypeMap::const_iterator iter( dof_type_map_.find( type ) );
281  if ( iter == dof_type_map_.end() ) {
282  return false;
283  }
284  return iter->second;
285 }
286 
287 ///////////////////////////////////////////////////////////////////////////////
288 ///@details get the setting for an individual dof, eg, PHI of Atom 3 in Residue 5
289 /// if no setting for this specific DOF_ID, get setting for the DOF type to
290 /// which this DOF_ID belongs to.
291 bool
292 MoveMap::get( DOF_ID const & id ) const
293 {
294  if ( !id.valid() ) return false;
295 
296  DOF_ID_Map::const_iterator iter( dof_id_map_.find( id ) );
297  if ( iter == dof_id_map_.end() ) {
298  return get( id.type() );
299  }
300  return iter->second;
301 }
302 
303 /// @brief find the explicit setting for the given TorsionType
304 /// @return iterator pointing to the TorsionType-bool pair, otherwise
305 /// torsion_type_end()
306 /// @warning Do not use this for general lookup, as it does not take
307 /// into account the stringency levels. Only use this when you need
308 /// to check if a setting explicitly exists.
309 MoveMap::TorsionTypeMap::const_iterator
310 MoveMap::find( TorsionType const & t ) const {
311  return torsion_type_map_.find( t );
312 }
313 
314 /// @brief find the explicit setting for the given MoveMapTorsionID
315 /// @return iterator pointing to the MoveMapTorsionID-bool pair, otherwise
316 /// movemap_torsion_id_end()
317 /// @warning Do not use this for general lookup, as it does not take
318 /// into account the stringency levels. Only use this when you need
319 /// to check if a setting explicitly exists.
320 MoveMap::MoveMapTorsionID_Map::const_iterator
321 MoveMap::find( MoveMapTorsionID const & id ) const {
322  return move_map_torsion_id_map_.find( id );
323 }
324 
325 
326 /// @brief find the explicit setting for the given TorsionID
327 /// @return iterator pointing to the TorsionID-bool pair, otherwise torsion_id_end()
328 /// @warning Do not use this for general lookup, as it does not take
329 /// into account the stringency levels. Only use this when you need
330 /// to check if a setting explicitly exists.
331 MoveMap::TorsionID_Map::const_iterator
332 MoveMap::find( TorsionID const & id ) const {
333  return torsion_id_map_.find( id );
334 }
335 
336 /// @brief find the explicit setting for the given JumpID
337 /// @return iterator pointing to the JumpID-bool pair, otherwise jump_id_end()
338 /// @warning Do not use this for general lookup, as it does not take
339 /// into account the stringency levels. Only use this when you need
340 /// to check if a setting explicitly exists.
341 MoveMap::JumpID_Map::const_iterator
342 MoveMap::find( id::JumpID const & jump ) const {
343  return jump_id_map_.find( jump );
344 }
345 
346 /// @brief find the explicit setting for the given DOF_Type
347 /// @return iterator pointing to the DOF_Type-bool pair, otherwise dof_type_end()
348 /// @warning Do not use this for general lookup, as it does not take
349 /// into account the stringency levels. Only use this when you need
350 /// to check if a setting explicitly exists.
351 MoveMap::DOF_TypeMap::const_iterator
352 MoveMap::find( DOF_Type const & t ) const {
353  return dof_type_map_.find( t );
354 }
355 
356 /// @brief find the explicit setting for the given DOF_ID
357 /// @return iterator pointing to the DOF_ID-bool pair, otherwise dof_id_end()
358 /// @warning Do not use this for general lookup, as it does not take
359 /// into account the stringency levels. Only use this when you need
360 /// to check if a setting explicitly exists.
361 MoveMap::DOF_ID_Map::const_iterator
362 MoveMap::find( DOF_ID const & id ) const {
363  return dof_id_map_.find( id );
364 }
365 
366 
367 /// @brief reads lines of format and set movemap
368 /// RESIDUE * CHI # set all residues chi movable
369 /// RESIDUE 36 48 BBCHI # set res 36-48 bb & chi movable
370 /// RESIDUE 89 NO # set res 89 unmovable
371 /// JUMP * NO # set all jumps unmovable
372 /// JUMP 1 YES # set jump 1 movable
373 /// If a residue/default is not specified, mm defaults to current value.
374 /// If a value for a jum is not given (e.g. "JUMP 4\n"), it defaults to movable (YES)
375 /// Setting 'CHI' implies BB not movable, thus don't do:
376 /// RESIDUE * CHI
377 /// RESIDUE * BB
378 /// Instead:
379 /// RESIDUE * BBCHI
380 void
381 MoveMap::init_from_file( std::string const & filename ) {
382  utility::io::izstream data( filename.c_str() );
383  if ( !data ) {
384  utility_exit_with_message("ERROR: could not open file " + filename );
385  }
386 
387 // Size seqpos;
388 // std::string token, line;
389 // while( getline(data,line) ) {
390 // if ( line.substr(0,1) == "#" ) continue;
391 // std::istringstream l( line );
392 // l >> seqpos >> token;
393 // if ( token == "BB" ) {
394 // set_bb( seqpos, true );
395 // } else if ( token == "CHI" ) {
396 // set_chi( seqpos, true );
397 // } else if ( token == "JUMP" ) {
398 // // here seqpos represents the JUMP number, NOT a sequence position!!
399 // set_jump( seqpos, true );
400 // } else {
401 // std::cerr << "ERROR: don't recognize token " << token << " in file "
402 // << filename << "!" << std::endl;
403 // }
404 // } // while( getline(data,line) )
405 
406  std::string line;
407  bool res_default_set=false, jump_default_set=false;
408  while( getline(data,line) ) {
409  if ( line.substr(0,1) == "#" ) continue;
410  if ( line == "" ) continue;
411 
413  if( tokens.size() > 0 ) {
414  if ( tokens[1] == "JUMP" || tokens[1] == "jump" ) {
415  if (tokens.size() < 2) {
416  utility_exit_with_message( "Error reading movemap at line: " + line );
417  }
418 
419  if ( tokens[2] == "*" ) {
420  if (jump_default_set) {
421  utility_exit_with_message( "Error reading movemap: default jump set multiple times!" );
422  } else {
423  jump_default_set=true;
424  if ( tokens.size() < 3 || tokens[3] == "YES" || tokens[3] == "yes" ) {
425  set_jump( true );
426  } else if (tokens[3] == "NO" || tokens[3] == "no" ){
427  set_jump( false );
428  } else {
429  utility_exit_with_message( "Error reading movemap at line: " + line );
430  }
431  }
432  } else {
433  core::Size jump_num = (core::Size) atoi(tokens[2].c_str());
434  if ( tokens.size() < 3 || tokens[3] == "YES" || tokens[3] == "yes" ) {
435  set_jump( jump_num, true );
436  } else if (tokens[3] == "NO" || tokens[3] == "no" ){
437  set_jump( jump_num, false );
438  } else {
439  utility_exit_with_message( "Error reading movemap at line: " + line );
440  }
441  }
442  } else if ( tokens[1] == "RESIDUE" || tokens[1] == "residue" ) {
443  if (tokens.size() < 3) {
444  utility_exit_with_message( "Error reading movemap at line: " + line );
445  }
446  if ( tokens[2] == "*" ) {
447  if (res_default_set) {
448  utility_exit_with_message( "Error reading movemap: default residue set multiple times!" );
449  } else {
450  res_default_set=true;
451  if ( tokens[3] == "BB" || tokens[3] == "bb" ) {
452  set_bb( true ); set_chi( false );
453  } else if (tokens[3] == "CHI" || tokens[3] == "chi" ){
454  set_bb( false ); set_chi( true );
455  } else if (tokens[3] == "BBCHI" || tokens[3] == "bbchi" ){
456  set_bb( true ); set_chi( true );
457  } else if (tokens[3] == "NO" || tokens[3] == "no" ){
458  set_bb( false ); set_chi( false );
459  } else {
460  utility_exit_with_message( "Error reading movemap at line: " + line );
461  }
462  }
463  } else if (tokens.size() == 3) {
464  core::Size start_res = (core::Size) atoi(tokens[2].c_str());
465  if ( tokens[3] == "BB" || tokens[3] == "bb" ) {
466  set_bb( start_res, true ); set_chi( start_res, false );
467  } else if (tokens[3] == "CHI" || tokens[3] == "chi" ){
468  set_bb( start_res, false ); set_chi( start_res, true );
469  } else if (tokens[3] == "BBCHI" || tokens[3] == "bbchi" ){
470  set_bb( start_res, true ); set_chi( start_res, true );
471  } else if (tokens[3] == "NO" || tokens[3] == "no" ){
472  set_bb( start_res, false ); set_chi( start_res, false );
473  } else {
474  utility_exit_with_message( "Error reading movemap at line: " + line );
475  }
476  } else {
477  core::Size start_res = (core::Size) atoi(tokens[2].c_str());
478  core::Size end_res = (core::Size) atoi(tokens[3].c_str());
479  if ( start_res > end_res ) {
480  utility_exit_with_message( "Error reading movemap at line: " + line );
481  }
482  if ( tokens[4] == "BB" || tokens[4] == "bb" ) {
483  for (core::Size i = start_res; i<= end_res; ++i) {
484  set_bb( i, true ); set_chi( i, false );
485  }
486  } else if (tokens[4] == "CHI" || tokens[4] == "chi" ){
487  for (core::Size i = start_res; i<= end_res; ++i) {
488  set_bb( i, false ); set_chi( i, true );
489  }
490  } else if (tokens[4] == "BBCHI" || tokens[4] == "bbchi" ){
491  for (core::Size i = start_res; i<= end_res; ++i) {
492  set_bb( i, true ); set_chi( i, true );
493  }
494  } else if (tokens[4] == "NO" || tokens[4] == "no" ){
495  for (core::Size i = start_res; i<= end_res; ++i) {
496  set_bb( i, false ); set_chi( i, false );
497  }
498  } else {
499  utility_exit_with_message( "Error reading movemap at line: " + line );
500  }
501  }
502  } else {
503  utility_exit_with_message( "Error reading movemap at line: " + line );
504  }
505  }
506  }
507 
508 } // init_from_file
509 
510 void
511 MoveMap::show( std::ostream & out, Size total_residue) const
512 {
513  PyAssert( (total_residue>0), "MoveMap::show( std::ostream & out , Size total_residue ): input variable total_residue has a meaningless value");
514  out <<A(8,"resnum")<<' '<<A(8,"BB") <<' '<<A(8,"CHI")<<std::endl;
515  for (Size i = 1; i <= total_residue; i++){
516  std::string bb = "FALSE";
517  std::string chi = "FALSE";
518  if (get_bb(i)) bb = "TRUE ";
519  if (get_chi(i)) chi = "TRUE ";
520  out << I(8,3,i) << ' '<<A(8, bb)<<' ' <<A(8, chi)<<'\n';
521  }
522  }
523 
524 void
525 MoveMap::show( std::ostream & out ) const
526 {
527  out << "-------------------------------\n";
528  out <<A(8,"resnum")<<' '<<A(8,"Type") <<' '<<A(12,"TRUE/FALSE ")<<std::endl;
529  out << "-------------------------------\n";
530  Size prev_resnum;
531  utility::vector1< bool > jumpbool;
532  utility::vector1< Size > jumpnum;
533  for (MoveMapTorsionID_Map::const_iterator it = movemap_torsion_id_begin(), it_end = movemap_torsion_id_end(); it != it_end; ++it){
534  MoveMapTorsionID mmtorsionID = it->first;
535  bool boolean = it->second;
536  Size res = mmtorsionID.first;
537  TorsionType torsiontype = mmtorsionID.second;
538 
539  // convert enum to string output
540  std::string type;
541  if (torsiontype == 1) {type = "BB ";}
542  else if (torsiontype == 2) {type = "SC ";}
543  else if (torsiontype == 3) {
544  type = "JUMP"; jumpbool.push_back(boolean); jumpnum.push_back(res);}
545 
546  // Only show each residue/jump number once (and only if torsion type is either BB or SC)
547  if ((prev_resnum == mmtorsionID.first) && (type != "JUMP")) {
548  out << A(8,' ') <<' '<< A(8,type) <<' '<< A(8,(boolean ? "TRUE":"FALSE"))<< "\n";
549  }
550  else if ((prev_resnum != mmtorsionID.first) && (type != "JUMP")) {
551  out << I(8,3,res) <<' '<< A(8,type) <<' '<< A(8,(boolean ? "TRUE":"FALSE"))<< "\n";
552  }
553 
554  // Remember the previous residue/jump number
555  prev_resnum = res;
556  }
557  out << "-------------------------------\n";
558  out <<A(8,"jumpnum")<<' '<<A(8,"Type") <<' '<<A(12,"TRUE/FALSE ")<<std::endl;
559  out << "-------------------------------\n";
560  for (Size i = 1; i <= jumpnum.size(); ++i) {
561  out << I(8,3,jumpnum[i])<<' '<< A(8,"JUMP") <<' '<< A(8,(jumpbool[i] ? "TRUE":"FALSE"))<< "\n";
562  }
563 }
564 
565 /// @brief import settings from another MoveMap
566 /// @param[in] rval The MoveMap to import settings from.
567 /// @param[in] import_true_settings Import True settings?
568 /// @param[in] import_false_settings Import False settings?
569 /// @return The total number of settings imported.
570 /// @remarks This function calls set() for each setting that exists in the
571 /// 'rval' MoveMap in order from lowest to highest stringency.
572 Size MoveMap::import(
573  MoveMap const & rval,
574  bool const import_true_settings,
575  bool const import_false_settings
576 )
577 {
578  // Import settings from the other movemap. Always add in order from
579  // lowest stringency to highest.
580  Size n = 0;
581 
582  // Step 1: torsions
583  // TorsionType
584  for ( TorsionTypeMap::const_iterator i = rval.torsion_type_begin(), ie = rval.torsion_type_end(); i != ie; ++i ) {
585  if ( ( import_true_settings && i->second ) || ( import_false_settings && !i->second ) ) {
586  set( i->first, i->second );
587  ++n;
588  }
589  }
590 
591  // MoveMapTorsionID
592  for ( MoveMapTorsionID_Map::const_iterator i = rval.movemap_torsion_id_begin(), ie = rval.movemap_torsion_id_end(); i != ie; ++i ) {
593  if ( ( import_true_settings && i->second ) || ( import_false_settings && !i->second ) ) {
594  set( i->first, i->second );
595  ++n;
596  }
597  }
598 
599  // TorsionID
600  for ( TorsionID_Map::const_iterator i = rval.torsion_id_begin(), ie = rval.torsion_id_end(); i != ie; ++i ) {
601  if ( ( import_true_settings && i->second ) || ( import_false_settings && !i->second ) ) {
602  set( i->first, i->second );
603  ++n;
604  }
605  }
606 
607  // Step 2: DOFs
608  // DOF_Type
609  for ( DOF_TypeMap::const_iterator i = rval.dof_type_begin(), ie = rval.dof_type_end(); i != ie; ++i ) {
610  if ( ( import_true_settings && i->second ) || ( import_false_settings && !i->second ) ) {
611  set( i->first, i->second );
612  ++n;
613  }
614  }
615 
616  // DOF_ID
617  for ( DOF_ID_Map::const_iterator i = rval.dof_id_begin(), ie = rval.dof_id_end(); i != ie; ++i ) {
618  if ( ( import_true_settings && i->second ) || ( import_false_settings && !i->second ) ) {
619  set( i->first, i->second );
620  ++n;
621  }
622  }
623 
624  // Step 3: jumps
625  // JumpID
626  for ( JumpID_Map::const_iterator i = rval.jump_id_begin(), ie = rval.jump_id_end(); i != ie; ++i ) {
627  if ( ( import_true_settings && i->second ) || ( import_false_settings && !i->second ) ) {
628  set_jump( i->first, i->second );
629  ++n;
630  }
631  }
632 
633  return n;
634 }
635 
636 } // namespace kinematics
637 } // namespace core