MaMiCo 1.2
Loading...
Searching...
No Matches
CouplingMDDefinitions.h
1// Copyright (C) 2015 Technische Universitaet Muenchen
2// This file is part of the Mamico project. For conditions of distribution
3// and use, please see the copyright notice in Mamico's main folder, or at
4// www5.in.tum.de/mamico
5#ifndef _MOLECULARDYNAMICS_COUPLING_COUPLINGMDDEFINITIONS_H_
6#define _MOLECULARDYNAMICS_COUPLING_COUPLINGMDDEFINITIONS_H_
7
8#define COUPLING_MD_NO 0
9#define COUPLING_MD_YES 1
10
11#if defined(MDCoupledDebug)
12#define COUPLING_MD_DEBUG COUPLING_MD_YES
13#else
14#define COUPLING_MD_DEBUG COUPLING_MD_NO
15#endif
16
17#if defined(MDCoupledError)
18#define COUPLING_MD_ERROR COUPLING_MD_YES
19#else
20#define COUPLING_MD_ERROR COUPLING_MD_NO
21#endif
22
23#if defined(MDCoupledParallel)
24#define COUPLING_MD_PARALLEL COUPLING_MD_YES
25#else
26#define COUPLING_MD_PARALLEL COUPLING_MD_NO
27#endif
28// message tags for MPI parallelisation. For each CouplingCellService, we add
29// the ID of the cell service to the tags from below to yield a unique tag for
30// each operation. this currently supports a maximum of <10M instances of
31// CouplingCellService.
32#define TAG_FROM_MD2MACRO 100000
33#define TAG_FROM_MACRO2MD 500000
34
35#define IDXS coupling::indexing::IndexingService<dim>::getInstance()
36
37#include "tarch/la/Vector.h"
38#include "tarch/utils/OstreamOperators.h"
39#include <map>
40#include <set>
41#include <vector>
42
43namespace coupling {
50
51// --------------------------- HELPER FUNCTIONS
52// ----------------------------------------
53
62 for (unsigned int d = 0; d < dim; d++) {
63 range[d] = vec[d];
64 }
65 return range;
66}
67
77 for (unsigned int d = 0; d < dim; d++) {
78 smallVec[d] = vec[d];
79 }
80 return smallVec;
81}
82
91 for (unsigned int d = 1; d < dim; d++) {
92 divFactor[d] = divFactor[d - 1] * (numberCells[d - 1]);
93 }
94 return divFactor;
95}
96
107template <unsigned int dim>
110 unsigned int help = cellIndex;
111 for (int d = dim - 1; d > 0; d--) {
112 myVector[d] = help / divisionFactor[d];
113 help = help - myVector[d] * divisionFactor[d];
114 }
115 myVector[0] = help;
116
117 return myVector;
118}
119
120} // namespace coupling
121#endif // _MOLECULARDYNAMICS_COUPLING_COUPLINGMDDEFINITIONS_H_
Definition Vector.h:24
everything necessary for coupling operations, is defined in here
Definition AdditiveMomentumInsertion.h:15
tarch::la::Vector< dim, unsigned int > initDimVector(tarch::la::Vector< 3, unsigned int > vec)
reduces three-dimensional vector to vector of size dim (assumes that dim<= 3).
Definition CouplingMDDefinitions.h:75
tarch::la::Vector< 3, unsigned int > initRange(tarch::la::Vector< dim, unsigned int > vec)
initialises the range for looping over Cartesian grid for general case
Definition CouplingMDDefinitions.h:60
MacroscopicSolverID
Definition CouplingMDDefinitions.h:46
@ PEANO_LATTICEBOLTZMANN_ID
test1
Definition CouplingMDDefinitions.h:47
@ TEST_LOCAL_MACROSCOPIC_SOLVER_ID
test2
Definition CouplingMDDefinitions.h:48
tarch::la::Vector< dim, unsigned int > initDivisionFactor(tarch::la::Vector< dim, unsigned int > numberCells)
Definition CouplingMDDefinitions.h:89
tarch::la::Vector< dim, unsigned int > getVectorCellIndex(unsigned int cellIndex, const tarch::la::Vector< dim, unsigned int > &divisionFactor)
converts linearised cell index to a vector cell index using predefined division factors.
Definition CouplingMDDefinitions.h:108