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

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 f6bd32 was f6bd32, checked in by Frederik Heber <heber@…>, 15 years ago

Case 'o' is now handled by CommandLineUI.

  • As of now, multiple "--offset" do not work. Hence, we invented new --convex-file and --nonconvex-file.
  • Property mode set to 100644
File size: 3.8 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 "config.hpp"
22#include "linkedcell.hpp"
23#include "log.hpp"
24#include "molecule.hpp"
25#include "verbose.hpp"
26#include "World.hpp"
27
28/****** TesselationConvexEnvelopeAction *****/
29
30// memento to remember the state when undoing
31
32//class TesselationConvexEnvelopeState : public ActionState {
33//public:
34// TesselationConvexEnvelopeState(molecule* _mol,std::string _lastName) :
35// mol(_mol),
36// lastName(_lastName)
37// {}
38// molecule* mol;
39// std::string lastName;
40//};
41
42const char TesselationConvexEnvelopeAction::NAME[] = "convex-envelope";
43
44TesselationConvexEnvelopeAction::TesselationConvexEnvelopeAction() :
45 Action(NAME)
46{}
47
48TesselationConvexEnvelopeAction::~TesselationConvexEnvelopeAction()
49{}
50
51Action::state_ptr TesselationConvexEnvelopeAction::performCall() {
52 string filenameConvex;
53 string filenameNonConvex;
54 Dialog *dialog = UIFactory::getInstance().makeDialog();
55 molecule * mol = NULL;
56 bool Success = false;
57 config *configuration = World::getInstance().getConfig();
58
59 dialog->queryMolecule(NAME, &mol, MapOfActions::getInstance().getDescription(NAME));
60 dialog->queryString("convex-file", &filenameConvex, MapOfActions::getInstance().getDescription("convex-file"));
61 dialog->queryString("nonconvex-file", &filenameNonConvex, MapOfActions::getInstance().getDescription("nonconvex-file"));
62
63 if(dialog->display()) {
64 class Tesselation *TesselStruct = NULL;
65 const LinkedCell *LCList = NULL;
66 DoLog(0) && (Log() << Verbose(0) << "Evaluating volume of the convex envelope.");
67 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot convex data in " << filenameConvex << "." << endl);
68 DoLog(1) && (Log() << Verbose(1) << "Storing tecplot non-convex data in " << filenameNonConvex << "." << endl);
69 LCList = new LinkedCell(mol, 100.);
70 //FindConvexBorder(mol, LCList, argv[argptr]);
71 // TODO: Beide Funktionen sollten streams anstelle des Filenamen benutzen, besser fuer unit tests
72 FindNonConvexBorder(mol, TesselStruct, LCList, 50., filenameNonConvex.c_str());
73 //RemoveAllBoundaryPoints(TesselStruct, mol, argv[argptr]);
74 const double volumedifference = ConvexizeNonconvexEnvelope(TesselStruct, mol, filenameConvex.c_str());
75 const double clustervolume = VolumeOfConvexEnvelope(TesselStruct, configuration);
76 DoLog(0) && (Log() << Verbose(0) << "The tesselated volume area is " << clustervolume << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl);
77 DoLog(0) && (Log() << Verbose(0) << "The non-convex tesselated volume area is " << clustervolume-volumedifference << " " << (configuration->GetIsAngstroem() ? "angstrom" : "atomiclength") << "^3." << endl);
78 delete(TesselStruct);
79 delete(LCList);
80 delete dialog;
81 if (Success)
82 return Action::success;
83 else
84 return Action::failure;
85 }
86 delete dialog;
87 return Action::failure;
88}
89
90Action::state_ptr TesselationConvexEnvelopeAction::performUndo(Action::state_ptr _state) {
91// TesselationConvexEnvelopeState *state = assert_cast<TesselationConvexEnvelopeState*>(_state.get());
92
93// string newName = state->mol->getName();
94// state->mol->setName(state->lastName);
95
96 return Action::failure;
97}
98
99Action::state_ptr TesselationConvexEnvelopeAction::performRedo(Action::state_ptr _state){
100 // Undo and redo have to do the same for this action
101 return performUndo(_state);
102}
103
104bool TesselationConvexEnvelopeAction::canUndo() {
105 return false;
106}
107
108bool TesselationConvexEnvelopeAction::shouldUndo() {
109 return false;
110}
111
112const string TesselationConvexEnvelopeAction::getName() {
113 return NAME;
114}
Note: See TracBrowser for help on using the repository browser.