--- branches/development/src/parallel/ForceDecomposition.hpp 2011/03/18 19:31:52 1544 +++ branches/development/src/parallel/ForceMatrixDecomposition.hpp 2011/05/26 13:55:04 1569 @@ -39,68 +39,116 @@ * [4] Vardeman & Gezelter, in progress (2009). */ -#ifndef PARALLEL_FORCEDECOMPOSITION_HPP -#define PARALLEL_FORCEDECOMPOSITION_HPP +#ifndef PARALLEL_FORCEMATRIXDECOMPOSITION_HPP +#define PARALLEL_FORCEMATRIXDECOMPOSITION_HPP -#include "Parallel/Decomposition.hpp" +#include "parallel/ForceDecomposition.hpp" #include "math/SquareMatrix3.hpp" +#include "brains/Snapshot.hpp" #ifdef IS_MPI -#include "Parallel/Communicator.hpp" +#include "parallel/Communicator.hpp" #endif using namespace std; namespace OpenMD { - class ForceDecomposition : public Decomposition { + class ForceMatrixDecomposition : public ForceDecomposition { public: - ForceDecomposition(SimInfo* info) : Decomposition(info) {sman_ = info_->getSnapshotManager();} + ForceMatrixDecomposition(SimInfo* info) : ForceDecomposition(info) {}; + void distributeInitialData(); void distributeData(); void collectIntermediateData(); void distributeIntermediateData(); void collectData(); - unsigned int getNcutoffGroupsI(); - unsigned int getNcutoffGroupsJ(); + // neighbor list routines + vector > buildNeighborList(); - vector getAtomsInGroupI(int whichCGI); - vector getAtomsInGroupJ(int whichCGJ); + // group bookkeeping + pair getGroupTypes(int cg1, int cg2); - AtomType* getAtomTypeI(int whichAtomI); - AtomType* getAtomTypeJ(int whichAtomJ); + // Group->atom bookkeeping + vector getAtomsInGroupRow(int cg1); + vector getAtomsInGroupColumn(int cg2); + Vector3d getAtomToGroupVectorRow(int atom1, int cg1); + Vector3d getAtomToGroupVectorColumn(int atom2, int cg2); + RealType getMassFactorRow(int atom1); + RealType getMassFactorColumn(int atom2); + // spatial data + Vector3d getIntergroupVector(int cg1, int cg2); + Vector3d getInteratomicVector(int atom1, int atom2); + + // atom bookkeeping + vector getAtomList(); + vector getSkipsForAtom(int atom1); + bool skipAtomPair(int atom1, int atom2); + void addForceToAtomRow(int atom1, Vector3d fg); + void addForceToAtomColumn(int atom2, Vector3d fg); + + // filling interaction blocks with pointers + InteractionData fillInteractionData(int atom1, int atom2); + InteractionData fillSkipData(int atom1, int atom2); + private: - SnapshotManager* sman_; + int nLocal_; + int nGroups_; + vector AtomLocalToGlobal; + vector cgLocalToGlobal; + vector pot_local; + vector massFactorsLocal; + #ifdef IS_MPI - Communicator* AtomCommIntI; - Communicator* AtomCommRealI; - Communicator* AtomCommVectorI; - Communicator* AtomCommMatrixI; + DataStorage atomRowData; + DataStorage atomColData; + DataStorage cgRowData; + DataStorage cgColData; - Communicator* AtomCommIntJ; - Communicator* AtomCommRealJ; - Communicator* AtomCommVectorJ; - Communicator* AtomCommMatrixJ; + int nAtomsInRow_; + int nAtomsInCol_; + int nGroupsInRow_; + int nGroupsInCol_; - Communicator* cgCommIntI; - Communicator* cgCommVectorI; - Communicator* cgCommIntJ; - Communicator* cgCommVectorJ; + Communicator* AtomCommIntRow; + Communicator* AtomCommRealRow; + Communicator* AtomCommVectorRow; + Communicator* AtomCommMatrixRow; + Communicator* AtomCommIntColumn; + Communicator* AtomCommRealColumn; + Communicator* AtomCommVectorColumn; + Communicator* AtomCommMatrixColumn; + + Communicator* cgCommIntRow; + Communicator* cgCommVectorRow; + Communicator* cgCommIntColumn; + Communicator* cgCommVectorColumn; + vector > pot_row; vector > pot_col; - vector identRow; - vector identCol; - vector AtomLocalToGlobal; + vector identsRow; + vector identsCol; + vector AtomRowToGlobal; vector AtomColToGlobal; - vector cgLocalToGlobal; + vector cgRowToGlobal; vector cgColToGlobal; + + vector > cellListRow_; + vector > cellListCol_; + + vector > groupListRow_; + vector > groupListCol_; + + vector massFactorsRow; + vector massFactorsCol; + #endif - vector pot_local; + }; }