aboutsummaryrefslogtreecommitdiff
path: root/code/computeRestrictedFneq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'code/computeRestrictedFneq.cpp')
-rw-r--r--code/computeRestrictedFneq.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/code/computeRestrictedFneq.cpp b/code/computeRestrictedFneq.cpp
new file mode 100644
index 0000000..cf796b1
--- /dev/null
+++ b/code/computeRestrictedFneq.cpp
@@ -0,0 +1,23 @@
+template <typename T, template<typename> class DESCRIPTOR>
+void computeRestrictedFneq(const SuperLattice2D<T,DESCRIPTOR>& lattice,
+ Vector<int,3> latticeR,
+ T restrictedFneq[DESCRIPTOR<T>::q])
+{
+ for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) {
+ const auto neighbor = latticeR
+ + {0, DESCRIPTOR<T>::c[iPop][0], DESCRIPTOR<T>::c[iPop][1]};
+ Cell<T,DESCRIPTOR> cell;
+ lattice.get(neighbor, cell);
+
+ T fNeq[DESCRIPTOR<T>::q] {};
+ lbHelpers<T,DESCRIPTOR>::computeFneq(cell, fNeq);
+
+ for (int jPop=0; jPop < DESCRIPTOR<T>::q; ++jPop) {
+ restrictedFneq[jPop] += fNeq[jPop];
+ }
+ }
+
+ for (int iPop=0; iPop < DESCRIPTOR<T>::q; ++iPop) {
+ restrictedFneq[iPop] /= DESCRIPTOR<T>::q;
+ }
+}