source: src/Actions/TesselationAction/ConvexEnvelopeAction.cpp@ a02462

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
Last change on this file since a02462 was 97ebf8, checked in by Frederik Heber <heber@…>, 15 years ago

Added all commands defined in ParseCommandLineOptions() as Actions.

  • Actions are not yet used, except verbose, version and help.
  • Files are present and included in Makefile.am
  • not unit tests written so far
  • no action has been tested so far (except for MapOfActions)
  • structure introduced to to transition from ParseCommandLineOptions to actions.
  • program name and config file are fixed arguments.

Signed-off-by: Frederik Heber <heber@…>

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * ConvexEnvelopeAction.cpp
3 *
4 * Created on: May 12, 2010
5 * Author: heber
6 */
7
8#include "Actions/TesselationAction/ConvexEnvelopeAction.hpp"
9
10#include <iostream>
11#include <string>
12
13using namespace std;
14
15#include "UIElements/UIFactory.hpp"
16#include "UIElements/Dialog.hpp"
17#include "Actions/MapOfActions.hpp"
18
19#include "atom.hpp"
20#include "boundary.hpp"
21#include "linkedcell.hpp"
22#include "log.hpp"
23#include "molecule.hpp"
24#include "verbose.hpp"
25#include "World.hpp"
26
27/****** TesselationConvexEnvelopeAction *****/
28
29// memento to remember the state when undoing
30
31//class TesselationConvexEnvelopeState : public ActionState {
32//public:
33// TesselationConvexEnvelopeState(molecule* _mol,std::string _lastName) :
34// mol(_mol),
35// lastName(_lastName)
36// {}
37// molecule* mol;
38// std::string lastName;
39//};
40
41const char TesselationConvexEnvelopeAction::NAME[] = "convex-envelope";
42
43TesselationConvexEnvelopeAction::TesselationConvexEnvelopeAction() :
44 Action(NAME)
45{}
46
47TesselationConvexEnvelopeAction::~TesselationConvexEnvelopeAction()
48{}
49
50Action::state_ptr TesselationConvexEnvelopeAction::performCall() {
51 string filenameConvex;
52 string filenameNonConvex;
53 Dialog *dialog = UIFactory::getInstance().makeDialog();
54 molecule * mol = NULL;
55 bool Success = false;
56
57 dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME));
58 dialog->queryString("output", &filenameConvex, MapOfActions::getInstance().getDescription("output"));
59 dialog->queryString("output", &filenameNonConvex, MapOfActions::getInstance().getDescription("output"));
60
61 if(dialog->display()) {
62 class Tesselation *TesselStruct = NULL;
63 const LinkedCell *LCList = NULL;
64 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
65 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << filenameConvex << "." << endl);
66 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << filenameNonConvex << "." << endl);
67 LCList = new LinkedCell(mol, 100.);
68 //FindConvexBorder(mol, LCList, argv[argptr]);
69 // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
70 FindNonConvexBorder(mol, TesselStruct, LCList, 50., filenameNonConvex.c_str());
71 //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]);
72 ConvexizeNonconvexEnvelope(TesselStruct, mol, filenameConvex.c_str());
73 delete(TesselStruct);
74 delete(LCList);
75 delete dialog;
76 if (Success)
77 return Action::success;
78 else
79 return Action::failure;
80 }
81 delete dialog;
82 return Action::failure;
83}
84
85Action::state_ptr TesselationConvexEnvelopeAction::performUndo(Action::state_ptr _state) {
86// TesselationConvexEnvelopeState *state = assert_cast<TesselationConvexEnvelopeState*>(_state.get());
87
88// string newName = state->mol->getName();
89// state->mol->setName(state->lastName);
90
91 return Action::failure;
92}
93
94Action::state_ptr TesselationConvexEnvelopeAction::performRedo(Action::state_ptr _state){
95 // Undo and redo have to do the same for this action
96 return performUndo(_state);
97}
98
99bool TesselationConvexEnvelopeAction::canUndo() {
100 return false;
101}
102
103bool TesselationConvexEnvelopeAction::shouldUndo() {
104 return false;
105}
106
107const string TesselationConvexEnvelopeAction::getName() {
108 return NAME;
109}
Note: See TracBrowser for help on using the repository browser.