From 94d3e79a8617f88dc0219cfdeedfa3147833719d Mon Sep 17 00:00:00 2001
From: Adrian Kummerlaender
Date: Mon, 24 Jun 2019 14:43:36 +0200
Subject: Initialize at openlb-1-3
---
src/geometry/blockGeometryView2D.hh | 171 ++++++++++++++++++++++++++++++++++++
1 file changed, 171 insertions(+)
create mode 100644 src/geometry/blockGeometryView2D.hh
(limited to 'src/geometry/blockGeometryView2D.hh')
diff --git a/src/geometry/blockGeometryView2D.hh b/src/geometry/blockGeometryView2D.hh
new file mode 100644
index 0000000..d038f8e
--- /dev/null
+++ b/src/geometry/blockGeometryView2D.hh
@@ -0,0 +1,171 @@
+/* This file is part of the OpenLB library
+ *
+ * Copyright (C) 2014 Mathias J. Krause
+ * E-mail contact: info@openlb.net
+ * The most recent release of OpenLB can be downloaded at
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * Representation of the 2D block geometry view -- generic implementation.
+ */
+
+#ifndef BLOCK_GEOMETRY_VIEW_2D_HH
+#define BLOCK_GEOMETRY_VIEW_2D_HH
+
+
+#include
+#include "geometry/blockGeometryView2D.h"
+
+
+namespace olb {
+
+template
+BlockGeometryView2D::BlockGeometryView2D
+(BlockGeometryStructure2D& originalBlockGeometry, int x0, int x1, int y0,
+ int y1)
+ : BlockGeometryStructure2D(originalBlockGeometry.getIcGlob()),
+ BlockStructure2D(x1-x0+1, y1-y0+1),
+ _originalBlockGeometry(&originalBlockGeometry), _x0(x0), _y0(y0),
+ _nx(x1-x0+1), _ny(y1-y0+1)
+{
+ this->_statistics = BlockGeometryStatistics2D(this);
+ addToStatisticsList( &(this->_statistics.getStatisticsStatus()) );
+}
+
+template
+BlockGeometryView2D::BlockGeometryView2D(BlockGeometryView2D const& rhs)
+ : BlockGeometryStructure2D(rhs),
+ BlockStructure2D(0,0)
+{
+ _originalBlockGeometry = rhs._originalBlockGeometry;
+ _x0 = rhs._x0;
+ _y0 = rhs._y0;
+ _nx = rhs._nx;
+ _ny = rhs._ny;
+ this->_iCglob = rhs._iCglob;
+ this->_statistics = BlockGeometryStatistics2D(this);
+ addToStatisticsList( &(this->_statistics.getStatisticsStatus()) );
+}
+
+template
+BlockGeometryView2D& BlockGeometryView2D::operator=(BlockGeometryView2D const& rhs)
+{
+ _originalBlockGeometry = rhs._originalBlockGeometry;
+ _x0 = rhs._x0;
+ _y0 = rhs._y0;
+ _nx = rhs._nx;
+ _ny = rhs._ny;
+ this->_iCglob = rhs._iCglob;
+ this->_statistics = BlockGeometryStatistics2D(this);
+ addToStatisticsList( &(this->_statistics.getStatisticsStatus()) );
+ return *this;
+}
+
+template
+BlockGeometryView2D::~BlockGeometryView2D()
+{
+ removeFromStatisticsList( &(this->_statistics.getStatisticsStatus()) );
+}
+
+template
+BlockStructure2D& BlockGeometryView2D::getBlockStructure()
+{
+ return *this;
+}
+
+template
+BlockGeometryStatistics2D& BlockGeometryView2D::getStatistics(bool verbose)
+{
+ return this->_statistics;
+}
+
+template
+BlockGeometryStatistics2D const& BlockGeometryView2D::getStatistics(bool verbose) const
+{
+ return this->_statistics;
+}
+
+template
+Vector BlockGeometryView2D::getOrigin() const
+{
+ Vector origin;
+ origin[0] = _originalBlockGeometry->getOrigin()[0] + _x0*getDeltaR();
+ origin[1] = _originalBlockGeometry->getOrigin()[1] + _y0*getDeltaR();
+ return origin;
+}
+
+template
+const T BlockGeometryView2D::getDeltaR() const
+{
+ return _originalBlockGeometry->getDeltaR();
+}
+
+template
+int BlockGeometryView2D::getNx() const
+{
+ return _nx;
+}
+
+template
+int BlockGeometryView2D::getNy() const
+{
+ return _ny;
+}
+
+
+template
+int& BlockGeometryView2D::get(int iX, int iY)
+{
+ return _originalBlockGeometry->get(_x0+iX, _y0+iY);
+}
+
+template
+const int& BlockGeometryView2D::get(int iX, int iY) const
+{
+ return _originalBlockGeometry->get(_x0+iX, _y0+iY);
+}
+
+template
+int BlockGeometryView2D::getMaterial(int iX, int iY) const
+{
+ return _originalBlockGeometry->getMaterial(_x0+iX, _y0+iY);
+}
+
+template
+void BlockGeometryView2D::getPhysR(T physR[2], const int& iX, const int& iY) const
+{
+ _originalBlockGeometry->getPhysR(physR, _x0 + iX, _y0 + iY);
+ return;
+}
+
+template
+void BlockGeometryView2D::addToStatisticsList(bool* statisticStatus)
+{
+ _originalBlockGeometry->addToStatisticsList(statisticStatus);
+}
+
+template
+void BlockGeometryView2D::removeFromStatisticsList(bool* statisticStatus)
+{
+ _originalBlockGeometry->removeFromStatisticsList(statisticStatus);
+}
+
+} // namespace olb
+
+#endif
--
cgit v1.2.3