From ada03c7f6e8b7fa26f686b674e7858e5740dd451 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sun, 22 Jan 2017 00:41:09 -0500 Subject: [PATCH] Give the codim > 0 VectorTools::project functions their own file. Since these functions don't go into the MatrixFree code we can split them off with a very small amount of overhead for the additional parallelization. This lowers the required memory for the last projection instantiation by about a gigabyte. Before: File name Memory, MB Time, s source/numerics/vector_tools_project.cc 2775 79 source/numerics/vector_tools_project_inst2.cc 2882 92 source/numerics/vector_tools_project_inst3.cc 3948 102 After: File name Memory, MB Time, s source/numerics/vector_tools_project_codim.cc 1843 28 source/numerics/vector_tools_project.cc 2774 76 source/numerics/vector_tools_project_inst2.cc 2829 81 source/numerics/vector_tools_project_inst3.cc 2823 86 --- source/numerics/CMakeLists.txt | 2 + source/numerics/vector_tools_project.inst.in | 2 +- source/numerics/vector_tools_project_codim.cc | 25 ++++++++++ .../vector_tools_project_codim.inst.in | 46 +++++++++++++++++++ 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 source/numerics/vector_tools_project_codim.cc create mode 100644 source/numerics/vector_tools_project_codim.inst.in diff --git a/source/numerics/CMakeLists.txt b/source/numerics/CMakeLists.txt index 5b6fbfac48..a770796fd7 100644 --- a/source/numerics/CMakeLists.txt +++ b/source/numerics/CMakeLists.txt @@ -51,6 +51,7 @@ SET(_src vector_tools_project_inst2.cc vector_tools_project_inst3.cc vector_tools_project_hp.cc + vector_tools_project_codim.cc vector_tools_project_qp.cc vector_tools_project_qpmf.cc vector_tools_rhs.cc @@ -81,6 +82,7 @@ SET(_inst vector_tools_point_value.inst.in vector_tools_point_gradient.inst.in vector_tools_project.inst.in + vector_tools_project_codim.inst.in vector_tools_project_hp.inst.in vector_tools_project_qp.inst.in vector_tools_project_qpmf.inst.in diff --git a/source/numerics/vector_tools_project.inst.in b/source/numerics/vector_tools_project.inst.in index b9fbf8f962..103b08b00c 100644 --- a/source/numerics/vector_tools_project.inst.in +++ b/source/numerics/vector_tools_project.inst.in @@ -16,7 +16,7 @@ for (VEC : REAL_SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { -#if deal_II_dimension <= deal_II_space_dimension +#if deal_II_dimension == deal_II_space_dimension namespace VectorTools \{ template diff --git a/source/numerics/vector_tools_project_codim.cc b/source/numerics/vector_tools_project_codim.cc new file mode 100644 index 0000000000..ae9a28babe --- /dev/null +++ b/source/numerics/vector_tools_project_codim.cc @@ -0,0 +1,25 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2017 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +#include + +DEAL_II_NAMESPACE_OPEN + +// ---------------------------- explicit instantiations -------------------- + +#include "vector_tools_project_codim.inst" + +DEAL_II_NAMESPACE_CLOSE diff --git a/source/numerics/vector_tools_project_codim.inst.in b/source/numerics/vector_tools_project_codim.inst.in new file mode 100644 index 0000000000..e68a3a0604 --- /dev/null +++ b/source/numerics/vector_tools_project_codim.inst.in @@ -0,0 +1,46 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2017 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +for (VEC : REAL_SERIAL_VECTORS ; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) +{ +#if deal_II_dimension < deal_II_space_dimension + namespace VectorTools \{ + + template + void project + (const Mapping &, + const DoFHandler &, + const ConstraintMatrix &, + const Quadrature &, + const Function &, + VEC &, + const bool, + const Quadrature &, + const bool); + + template + void project + (const DoFHandler &, + const ConstraintMatrix &, + const Quadrature &, + const Function &, + VEC &, + const bool, + const Quadrature &, + const bool); + \} +#endif +} -- 2.39.5