Ignore:
Timestamp:
Apr 29, 2014, 12:42:43 PM (11 years ago)
Author:
Frederik Heber <heber@…>
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:
9bac15
Parents:
237f93
git-author:
Frederik Heber <heber@…> (01/11/14 20:57:55)
git-committer:
Frederik Heber <heber@…> (04/29/14 12:42:43)
Message:

FIX: SubgraphDissectionAction is now a MakroAction, fixed store-session.

  • store-session would skip the select-atoms part.
  • hence, now we just write SubgraphDissection() command to python script.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/GraphAction/SubgraphDissectionAction.cpp

    r237f93 rf47e00b  
    4747#include "Descriptors/AtomDescriptor.hpp"
    4848
     49using namespace MoleCuilder;
     50
     51// and construct the stuff
    4952#include "SubgraphDissectionAction.def"
    50 
    51 // some derived names: if CATEGORY is not given, we don't prefix with it
    52 #ifdef CATEGORY
    53 #define ACTION BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Action))
    54 #define COMMAND BOOST_PP_CAT(CATEGORY, ACTIONNAME)
    55 #define PARAMS BOOST_PP_CAT(CATEGORY, BOOST_PP_CAT(ACTIONNAME, Parameters))
    56 #else
    57 #define ACTION BOOST_PP_CAT(ACTIONNAME, Action)
    58 #define COMMAND ACTIONNAME
    59 #define PARAMS BOOST_PP_CAT(ACTIONNAME, Parameters)
    60 #endif
    61 // check if no lists given
    62 #ifndef paramtypes
    63 #define MAXPARAMTYPES 0
    64 #else
    65 #define MAXPARAMTYPES BOOST_PP_SEQ_SIZE(paramtypes)
    66 #endif
    67 #ifndef paramdefaults
    68 #define MAXPARAMDEFAULTS 0
    69 #else
    70 #define MAXPARAMDEFAULTS BOOST_PP_SEQ_SIZE(paramdefaults)
    71 #endif
    72 
    73 namespace MoleCuilder {
     53#include "MakroAction_impl_pre.hpp"
     54/** =========== define the function ====================== */
    7455
    7556// static instances
     
    7758bool GraphSubgraphDissectionAction::isPrepared = false;
    7859
    79 GraphSubgraphDissectionAction::GraphSubgraphDissectionAction() :
    80   MakroAction(ActionTraits< GraphSubgraphDissectionAction >(), actions)
    81 {}
    82 
    83 GraphSubgraphDissectionAction::~GraphSubgraphDissectionAction()
    84 {}
    85 
    8660void GraphSubgraphDissectionAction::prepare(ActionRegistry &AR)
    8761{
     62  actions.addAction(AR.getActionByName(std::string("select-all-atoms")));
    8863  actions.addAction(AR.getActionByName(std::string("destroy-adjacency")));
    8964  actions.addAction(AR.getActionByName(std::string("create-adjacency")));
     
    11186  // we need to "emulate" that all atoms have been selected without destroying
    11287  // current selection
    113   Chronos::getInstance().startTiming(TOKEN);
    11488  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
    115   World::getInstance().selectAllAtoms(AllAtoms());
    11689  ActionState::ptr state(MakroAction::performCall());
    11790  reselectAtoms(selected_atoms);
    118   Chronos::getInstance().endTiming(TOKEN);
    11991
    12092  return state;
     
    12597  // current selection
    12698  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
    127   World::getInstance().selectAllAtoms(AllAtoms());
    12899  ActionState::ptr state(MakroAction::performUndo(_state));
    129100  reselectAtoms(selected_atoms);
     
    136107  // current selection
    137108  const std::vector<atom *> selected_atoms = World::getInstance().getSelectedAtoms();
    138   World::getInstance().selectAllAtoms(AllAtoms());
    139109  ActionState::ptr state(MakroAction::performRedo(_state));
    140110  reselectAtoms(selected_atoms);
     
    143113}
    144114
    145 // =========== command for calling action directly ===========
    146 void COMMAND(
    147 #if defined paramtypes && defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
    148 #define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, paramtypes, paramreferences)
    149 #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
    150 #include BOOST_PP_LOCAL_ITERATE()
    151 #endif
    152 )
    153 {
    154   ACTION *ToCall = dynamic_cast<ACTION*>(ActionQueue::getInstance().getActionByName( TOKEN )); //->clone(params);
    155   //ACTION::PARAMS params;
    156 #if defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
    157 #define BOOST_PP_LOCAL_MACRO(n) value_print(~, n, paramreferences, ToCall->params.)
    158 #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
    159 #include BOOST_PP_LOCAL_ITERATE()
    160 #endif
    161   ActionQueue::getInstance().queueAction( ToCall, Action::NonInteractive);
    162 };
     115bool GraphSubgraphDissectionAction::canUndo(){
     116  return true;
     117}
    163118
    164 void BOOST_PP_CAT( COMMAND, _stringargs)(
    165 #if defined paramtypes && defined paramreferences && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
    166 #define BOOST_PP_LOCAL_MACRO(n) type_list(~, n, BOOST_PP_SEQ_TRANSFORM( type2string, , paramtypes), paramreferences)
    167 #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
    168 #include BOOST_PP_LOCAL_ITERATE()
    169 #endif
    170   ) {
    171   ACTION *ToCall = dynamic_cast<ACTION*>(ActionQueue::getInstance().getActionByName( TOKEN )); //->clone(params);
    172   //ACTION::PARAMS params;
    173 #if defined paramtypes && defined paramtypes && BOOST_PP_NOT_EQUAL(MAXPARAMTYPES,0)
    174 #define BOOST_PP_LOCAL_MACRO(n) valuetype_print(~, n, paramreferences, paramtypes, ToCall->params. )
    175 #define BOOST_PP_LOCAL_LIMITS  (0, MAXPARAMTYPES-1)
    176 #include BOOST_PP_LOCAL_ITERATE()
    177 #endif
    178   ActionQueue::getInstance().queueAction( ToCall, Action::NonInteractive);
    179 };
    180 
     119bool GraphSubgraphDissectionAction::shouldUndo(){
     120  return true;
    181121}
Note: See TracChangeset for help on using the changeset viewer.