source: src/LinkedCell/LinkedCell_Model.hpp@ cf6530

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

Shifted functionality of adding, moving, and deleting nodes to internal functions.

  • internal functions are so far short-wired to outside.
  • this is preparatory for caching changes (lazy evaluation).
  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[d82961]1/*
2 * LinkedCell_Model.hpp
3 *
4 * Created on: Nov 15, 2011
5 * Author: heber
6 */
7
8#ifndef LINKEDCELL_MODEL_HPP_
9#define LINKEDCELL_MODEL_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16#include <boost/multi_array.hpp>
17#include <map>
18
[2614e2a]19#include "CodePatterns/Observer/Observer.hpp"
[d82961]20#include "LinearAlgebra/defs.hpp"
21#include "LinearAlgebra/RealSpaceMatrix.hpp"
[4459fc]22#include "LinkedCell/tripleIndex.hpp"
[d82961]23#include "LinkedCell/types.hpp"
24
25class Box;
26class IPointCloud;
27class LinkedCell_ModelTest;
28class TesselPoint;
29class Vector;
30
31namespace LinkedCell {
32
33 /** This is the model in the MVC ansatz for the LinkedCell structure.
34 *
35 * \sa linkedcell
36 *
37 * The model represents a certain linked cell structure with a specific mesh
38 * size (i.e. edge length). Note that all coordinates are internally always
39 * transformed to [0,1]^3, hence we require the domain (\ref Box) for the
40 * transformation matrices.
41 *
42 * This class stores internally list of particles in three-dimensional arrays.
43 *
44 */
[2614e2a]45 class LinkedCell_Model : public Observer
[d82961]46 {
47 //!> grant unit test access to internal structure
48 friend class ::LinkedCell_ModelTest;
49 public:
50 LinkedCell_Model(const double radius, const Box &_domain);
51 LinkedCell_Model(IPointCloud &set, const double radius, const Box &_domain);
52 ~LinkedCell_Model();
53
54 typedef std::pair<tripleIndex,tripleIndex> LinkedCellNeighborhoodBounds;
55
56 const tripleIndex getIndexToVector(const Vector &position) const;
57 const LinkedCellNeighborhoodBounds getNeighborhoodBounds(const tripleIndex &index, const tripleIndex &step = NearestNeighbors) const;
58 const tripleIndex getStep(const double distance) const;
59 const LinkedCell& getCell(const tripleIndex &index) const;
60 bool checkArrayBounds(const tripleIndex &index) const;
61 void applyBoundaryConditions(tripleIndex &index) const;
[53d894]62 bool empty() const { return CellLookup.size() == 0; }
[d82961]63
[029870]64 void addNode(const TesselPoint *Walker);
[d82961]65 void deleteNode(const TesselPoint *Walker);
66 void moveNode(const TesselPoint *Walker);
67
68 void setPartition(double distance);
69
[c80643]70 void insertPointCloud(IPointCloud &set);
71
[d82961]72 //!> static indices to get nearest neighbors as default argument
73 static tripleIndex NearestNeighbors;
74
[2614e2a]75 protected:
76 void update(Observable *publisher);
77 void recieveNotification(Observable *publisher, Notification_ptr notification);
78 void subjectKilled(Observable *publisher);
79
[d82961]80 private:
81 void AllocateCells();
82 void Reset();
83
[402f2c]84 void startListening();
85 void stopListening();
86
[db8960]87 void addNode_internal(const TesselPoint *Walker);
88 void deleteNode_internal(const TesselPoint *Walker);
89 void moveNode_internal(const TesselPoint *Walker);
90
[d82961]91 LinkedCellArray::index getSize(const size_t dim) const;
92
93 typedef LinkedCellArray::size_type size_type;
94 typedef LinkedCellArray::iterator iterator3;
95 typedef boost::subarray_gen<LinkedCellArray, NDIM-1>::type::iterator iterator2;
96 typedef boost::subarray_gen<LinkedCellArray, NDIM-2>::type::iterator iterator1;
97
[029870]98 typedef std::map<const TesselPoint *, LinkedCell *> MapPointToCell;
[d82961]99
100 //!> internal shape of multi_array
101 size_type *internal_Sizes;
102
103 //!> internal index of current cell, this makes going through linked cell faster
104 tripleIndex internal_index;
105
106 //!> Lookup map to get the cell for a given TesselPoint
107 MapPointToCell CellLookup;
108
109 //!> edge length per axis
110 boost::array<double, 3> EdgeLength;
111
112 //!> Linked cell array
113 LinkedCellArray N;
114
115 //!> matrix to divide Box with
116 RealSpaceMatrix Dimensions;
117
118 //!> matrix to transform normal position to obtain partitioned position
119 RealSpaceMatrix Partition;
120
121 //!> Box with matrix transformations and boundary conditions
122 const Box &domain;
123 };
124
125}
126
127// inlined functions
128#include "LinkedCell_Model_inline.hpp"
129
130#endif /* LINKEDCELL_MODEL_HPP_ */
Note: See TracBrowser for help on using the repository browser.