Changeset afd9f3 for src/Actions


Ignore:
Timestamp:
Jul 22, 2010, 8:59:33 PM (15 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:
805636
Parents:
ff4fd2a
Message:

converted AddEmptyBoundaryAction to new createDialog().

Location:
src/Actions/WorldAction
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    rff4fd2a rafd9f3  
    2222#include "UIElements/UIFactory.hpp"
    2323#include "UIElements/Dialog.hpp"
    24 #include "Actions/MapOfActions.hpp"
     24#include "UIElements/ValueStorage.hpp"
    2525#include "Helpers/Assert.hpp"
    2626
     
    3434{}
    3535
     36Dialog* WorldAddEmptyBoundaryAction::createDialog() {
     37  Dialog *dialog = UIFactory::getInstance().makeDialog();
     38
     39  dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
     40
     41  return dialog;
     42}
     43
    3644Action::state_ptr WorldAddEmptyBoundaryAction::performCall() {
    37   Dialog *dialog = UIFactory::getInstance().makeDialog();
    3845  Vector boundary;
    3946  Vector Min;
     
    4148  int j=0;
    4249
    43   dialog->queryVector(NAME, &boundary, false, MapOfActions::getInstance().getDescription(NAME));
     50  ValueStorage::getInstance().queryCurrentValue(NAME, boundary);
    4451
    45   if(dialog->display()) {
    46     // get maximum and minimum
    47     vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
    48     ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary.");
    49     vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    50     Min = (*AtomRunner)->x;
    51     Max = (*AtomRunner)->x;
    52     for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
    53       for (int i=0;i<NDIM;i++) {
    54         if ((*AtomRunner)->x[i] > Max[i])
    55           Max[i] = (*AtomRunner)->x[i];
    56         if ((*AtomRunner)->x[i] < Min[i])
    57           Min[i] = (*AtomRunner)->x[i];
    58       }
     52  // get maximum and minimum
     53  vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
     54  ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary.");
     55  vector<atom *>::iterator AtomRunner = AllAtoms.begin();
     56  Min = (*AtomRunner)->x;
     57  Max = (*AtomRunner)->x;
     58  for (; AtomRunner != AllAtoms.end(); ++AtomRunner) {
     59    for (int i=0;i<NDIM;i++) {
     60      if ((*AtomRunner)->x[i] > Max[i])
     61        Max[i] = (*AtomRunner)->x[i];
     62      if ((*AtomRunner)->x[i] < Min[i])
     63        Min[i] = (*AtomRunner)->x[i];
    5964    }
    60     // set new box size
    61     double * const cell_size = new double[6];
    62     for (j=0;j<6;j++)
    63       cell_size[j] = 0.;
    64     j=-1;
    65     for (int i=0;i<NDIM;i++) {
    66       j += i+1;
    67       cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]);
    68     }
    69     World::getInstance().setDomain(cell_size);
    70     delete[] cell_size;
    71     // translate all atoms, such that Min is aty (0,0,0)
    72     AtomRunner = AllAtoms.begin();
    73     for (; AtomRunner != AllAtoms.end(); ++AtomRunner)
    74       (*AtomRunner)->x -= Min - boundary;
    75     delete dialog;
    76     return Action::success;
    77   } else {
    78     delete dialog;
    79     return Action::failure;
    8065  }
     66  // set new box size
     67  double * const cell_size = new double[6];
     68  for (j=0;j<6;j++)
     69    cell_size[j] = 0.;
     70  j=-1;
     71  for (int i=0;i<NDIM;i++) {
     72    j += i+1;
     73    cell_size[j] = (Max[i]-Min[i]+2.*boundary[i]);
     74  }
     75  World::getInstance().setDomain(cell_size);
     76  delete[] cell_size;
     77  // translate all atoms, such that Min is aty (0,0,0)
     78  AtomRunner = AllAtoms.begin();
     79  for (; AtomRunner != AllAtoms.end(); ++AtomRunner)
     80    (*AtomRunner)->x -= Min - boundary;
     81  return Action::success;
    8182}
    8283
  • src/Actions/WorldAction/AddEmptyBoundaryAction.hpp

    rff4fd2a rafd9f3  
    2121  virtual const std::string getName();
    2222private:
     23  virtual Dialog * createDialog();
    2324  virtual Action::state_ptr performCall();
    2425  virtual Action::state_ptr performUndo(Action::state_ptr);
Note: See TracChangeset for help on using the changeset viewer.