From 4ee3a4c062f66d0bad023bfefe0ed57fba8bcbc2 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Fri, 26 Oct 2012 10:07:46 +0000 Subject: [PATCH] add VectorInfo class git-svn-id: https://svn.dealii.org/trunk@27202 0785d39b-7218-0410-832d-ea1e28bc413d --- .../include/deal.II/meshworker/vector_info.h | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 deal.II/include/deal.II/meshworker/vector_info.h diff --git a/deal.II/include/deal.II/meshworker/vector_info.h b/deal.II/include/deal.II/meshworker/vector_info.h new file mode 100644 index 0000000000..e768b7a929 --- /dev/null +++ b/deal.II/include/deal.II/meshworker/vector_info.h @@ -0,0 +1,121 @@ +//--------------------------------------------------------------------------- +// $Id: mesh_worker_info.h 23936 2011-07-09 17:02:27Z kanschat $ +// +// Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 by the deal.II authors +// +// This file is subject to QPL and may not be distributed +// without copyright and license information. Please refer +// to the file deal.II/doc/license.html for the text and +// further information on this license. +// +//--------------------------------------------------------------------------- + +#ifndef __deal2__mesh_worker_vector_info_h +#define __deal2__mesh_worker_vector_info_h + +#include +#include +#include + +using namespace dealii; + +class VectorInfo +{ + public: + /** + * Initialize the data + * vector and cache the + * selector. + */ + void initialize_data(const NamedData*>&data); + + template + void reinit(const MeshWorker::DoFInfo& i); + + BlockVector& operator() (unsigned int i); + + private: + std::vector > local_data; + /** + * The global data vector + * used to compute function + * values in quadrature + * points. + */ + SmartPointer*> > global_data; +}; + + +class VectorInfoBox + { + public: + typedef VectorInfo CellInfo; + + void initialize_data(const NamedData*>&data); + + template + void post_cell(const MeshWorker::DoFInfoBox&) + {} + + template + void post_faces(const MeshWorker::DoFInfoBox&) + {} + + VectorInfo cell; + VectorInfo boundary; + VectorInfo face; + VectorInfo subface; + VectorInfo neighbor; + }; + + +inline +void +VectorInfo::initialize_data(const NamedData*>&data) +{ + global_data = &data; + local_data.resize(global_data->size()); +} + + +template +inline +void +VectorInfo::reinit(const MeshWorker::DoFInfo& i) +{ + const NamedData*>& gd = *global_data; + + for (unsigned int k=0;k& v = *gd(k); + + local_data[k].reinit(i.block_info->local()); + for (unsigned int j=0;j& +VectorInfo::operator() (unsigned int i) +{ + AssertIndexRange(i, local_data.size()); + return local_data[i]; +} + + +inline +void +VectorInfoBox::initialize_data(const NamedData*>&data) +{ + cell.initialize_data(data); + boundary.initialize_data(data); + face.initialize_data(data); + subface.initialize_data(data); + neighbor.initialize_data(data); +} + + + +#endif -- 2.39.5