Changeset d02e07 for src/Actions/MapOfActions.cpp
- Timestamp:
- Jul 22, 2010, 7:11:35 PM (14 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- 75dc28
- Parents:
- 0c9cc3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MapOfActions.cpp
r0c9cc3 rd02e07 10 10 using namespace std; 11 11 12 #include "Actions/MapOfActions.hpp" 13 #include "Descriptors/AtomIdDescriptor.hpp" 14 #include "Descriptors/MoleculeIdDescriptor.hpp" 12 15 #include "Patterns/Singleton_impl.hpp" 13 #include "Actions/MapOfActions.hpp"14 16 #include "Helpers/Assert.hpp" 15 17 … … 21 23 22 24 #include "atom.hpp" 25 #include "Box.hpp" 23 26 #include "CommandLineParser.hpp" 24 27 #include "element.hpp" 25 28 #include "log.hpp" 29 #include "Matrix.hpp" 26 30 #include "molecule.hpp" 31 #include "periodentafel.hpp" 32 #include "vector.hpp" 27 33 #include "verbose.hpp" 28 34 … … 30 36 #include "Actions/AnalysisAction/MolecularVolumeAction.hpp" 31 37 #include "Actions/AnalysisAction/PairCorrelationAction.hpp" 38 #include "Actions/AnalysisAction/PointCorrelationAction.hpp" 32 39 #include "Actions/AnalysisAction/PrincipalAxisSystemAction.hpp" 40 #include "Actions/AnalysisAction/SurfaceCorrelationAction.hpp" 33 41 #include "Actions/AtomAction/AddAction.hpp" 34 42 #include "Actions/AtomAction/ChangeElementAction.hpp" … … 497 505 } 498 506 507 void MapOfActions::queryCurrentValue(const char * name, class atom * &_T) 508 { 509 int atomID = -1; 510 if (typeid( atom ) == *TypeMap[name]) 511 atomID = lexical_cast<int>(CurrentValue[name].c_str()); 512 else 513 throw IllegalTypeException(__FILE__,__LINE__); 514 _T = World::getInstance().getAtom(AtomById(atomID)); 515 } 516 517 void MapOfActions::queryCurrentValue(const char * name, class element * &_T) { 518 int Z = -1; 519 if (typeid( element ) == *TypeMap[name]) 520 Z = lexical_cast<int>(CurrentValue[name].c_str()); 521 else 522 throw IllegalTypeException(__FILE__,__LINE__); 523 _T = World::getInstance().getPeriode()->FindElement(Z); 524 } 525 526 void MapOfActions::queryCurrentValue(const char * name, class molecule * &_T) { 527 int molID = -1; 528 if (typeid( molecule ) == *TypeMap[name]) 529 molID = lexical_cast<int>(CurrentValue[name].c_str()); 530 else 531 throw IllegalTypeException(__FILE__,__LINE__); 532 _T = World::getInstance().getMolecule(MoleculeById(molID)); 533 } 534 535 void MapOfActions::queryCurrentValue(const char * name, class Box &_T) { 536 Matrix M; 537 double tmp; 538 if (typeid( BoxValue ) == *TypeMap[name]) { 539 std::istringstream stream(CurrentValue[name]); 540 stream >> tmp; 541 M.set(0,0,tmp); 542 stream >> tmp; 543 M.set(0,1,tmp); 544 M.set(1,0,tmp); 545 stream >> tmp; 546 M.set(0,2,tmp); 547 M.set(2,0,tmp); 548 stream >> tmp; 549 M.set(1,1,tmp); 550 stream >> tmp; 551 M.set(1,2,tmp); 552 M.set(2,1,tmp); 553 stream >> tmp; 554 M.set(2,2,tmp); 555 } else 556 throw IllegalTypeException(__FILE__,__LINE__); 557 } 558 559 void MapOfActions::queryCurrentValue(const char * name, class Vector &_T) { 560 if (typeid( VectorValue ) == *TypeMap[name]) { 561 std::istringstream stream(CurrentValue[name]); 562 stream >> _T[0]; 563 stream >> _T[1]; 564 stream >> _T[2]; 565 } else 566 throw IllegalTypeException(__FILE__,__LINE__); 567 } 568 569 void MapOfActions::queryCurrentValue(const char * name, std::vector<element *>&_T) 570 { 571 int Z = -1; 572 element *elemental = NULL; 573 if (typeid( std::vector<element *> ) == *TypeMap[name]) { 574 std::istringstream stream(CurrentValue[name]); 575 while (!stream.fail()) { 576 stream >> Z; 577 elemental = World::getInstance().getPeriode()->FindElement(Z); 578 if (elemental != NULL) 579 _T.push_back(elemental); 580 } 581 } else 582 throw IllegalTypeException(__FILE__,__LINE__); 583 } 584 585 586 void MapOfActions::setCurrentValue(const char * name, class atom * &_T) 587 { 588 if (typeid( atom ) == *TypeMap[name]) { 589 std::ostringstream stream; 590 stream << _T->getId(); 591 CurrentValue[name] = stream.str(); 592 } else 593 throw IllegalTypeException(__FILE__,__LINE__); 594 } 595 596 void MapOfActions::setCurrentValue(const char * name, class element * &_T) 597 { 598 if (typeid( element ) == *TypeMap[name]) { 599 std::ostringstream stream; 600 stream << _T->Z; 601 CurrentValue[name] = stream.str(); 602 } else 603 throw IllegalTypeException(__FILE__,__LINE__); 604 } 605 606 void MapOfActions::setCurrentValue(const char * name, class molecule * &_T) 607 { 608 if (typeid( molecule ) == *TypeMap[name]) { 609 std::ostringstream stream; 610 stream << _T->getId(); 611 CurrentValue[name] = stream.str(); 612 } else 613 throw IllegalTypeException(__FILE__,__LINE__); 614 } 615 616 void MapOfActions::setCurrentValue(const char * name, class Box &_T) 617 { 618 const Matrix &M = _T.getM(); 619 if (typeid( Box ) == *TypeMap[name]) { 620 std::ostringstream stream; 621 stream << M.at(0,0) << " "; 622 stream << M.at(0,1) << " "; 623 stream << M.at(0,2) << " "; 624 stream << M.at(1,1) << " "; 625 stream << M.at(1,2) << " "; 626 stream << M.at(2,2) << " "; 627 CurrentValue[name] = stream.str(); 628 } else 629 throw IllegalTypeException(__FILE__,__LINE__); 630 } 631 632 void MapOfActions::setCurrentValue(const char * name, class Vector &_T) 633 { 634 if (typeid( Vector ) == *TypeMap[name]){ 635 std::ostringstream stream; 636 stream << _T[0] << " "; 637 stream << _T[1] << " "; 638 stream << _T[2] << " "; 639 CurrentValue[name] = stream.str(); 640 } else 641 throw IllegalTypeException(__FILE__,__LINE__); 642 } 643 644 void MapOfActions::setCurrentValue(const char * name, std::vector<element *>&_T) 645 { 646 if (typeid( std::vector<element *> ) == *TypeMap[name]) { 647 std::ostringstream stream; 648 for (std::vector<element *>::iterator iter = _T.begin(); iter != _T.end(); ++iter) { 649 stream << (*iter)->Z; 650 } 651 CurrentValue[name] = stream.str(); 652 } else 653 throw IllegalTypeException(__FILE__,__LINE__); 654 } 655 656 499 657 500 658 void MapOfActions::populateActions() … … 502 660 new AnalysisMolecularVolumeAction(); 503 661 new AnalysisPairCorrelationAction(); 662 new AnalysisPointCorrelationAction(); 504 663 new AnalysisPrincipalAxisSystemAction(); 664 new AnalysisSurfaceCorrelationAction(); 505 665 506 666 new AtomAddAction();
Note:
See TracChangeset
for help on using the changeset viewer.