Skip to content
Snippets Groups Projects
Commit 8e0ed65c authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

fix NumLib and ProcessLib circular dependency.

parent 67f7f90c
No related branches found
No related tags found
No related merge requests found
Showing
with 69 additions and 52 deletions
......@@ -24,7 +24,7 @@
#include "Applications/ApplicationsLib/ProjectData.h"
#include "Applications/ApplicationsLib/UncoupledProcessesTimeLoop.h"
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
int main(int argc, char *argv[])
......
......@@ -12,12 +12,11 @@
#include <vector>
#include "ProcessLib/NumericsConfig.h"
namespace MathLib
{
/// A vector telling how many nonzeros there are in each global matrix row.
using SparsityPattern = std::vector<GlobalIndexType>;
template <typename IndexType>
using SparsityPattern = std::vector<IndexType>;
}
#endif // MATHLIB_LINALG_SPARSITYPATTERN_H
......@@ -21,7 +21,7 @@
#include <boost/multi_index_container.hpp>
#include "MeshLib/Location.h"
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
namespace NumLib
{
......
......@@ -14,7 +14,7 @@
namespace NumLib
{
MathLib::SparsityPattern computeSparsityPattern(
GlobalSparsityPattern computeSparsityPattern(
LocalToGlobalIndexMap const& dof_table, MeshLib::Mesh const& mesh)
{
MeshLib::NodeAdjacencyTable node_adjacency_table;
......@@ -31,7 +31,7 @@ MathLib::SparsityPattern computeSparsityPattern(
global_idcs.push_back(dof_table.getGlobalIndices(l));
}
MathLib::SparsityPattern sparsity_pattern(dof_table.dofSizeWithGhosts());
GlobalSparsityPattern sparsity_pattern(dof_table.dofSizeWithGhosts());
// Map adjacent mesh nodes to "adjacent global indices".
for (std::size_t n=0; n<mesh.getNNodes(); ++n)
......
......@@ -12,8 +12,7 @@
#include <vector>
#include "MathLib/LinAlg/SparsityPattern.h"
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
namespace MeshLib
{
......@@ -32,7 +31,7 @@ class LocalToGlobalIndexMap;
*
* @return The computed sparsity pattern.
*/
MathLib::SparsityPattern computeSparsityPattern(
GlobalSparsityPattern computeSparsityPattern(
LocalToGlobalIndexMap const& dof_table, MeshLib::Mesh const& mesh);
}
......
......@@ -7,9 +7,9 @@
*
*/
#include<memory>
#include <memory>
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
#include "GlobalMatrixProviders.h"
#include "SimpleMatrixVectorProvider.h"
......
......@@ -12,7 +12,7 @@
#include <cstddef>
#include "MathLib/LinAlg/SparsityPattern.h"
#include "NumLib/NumericsConfig.h"
namespace NumLib { class LocalToGlobalIndexMap; }
namespace MeshLib { class Mesh; }
......@@ -23,7 +23,7 @@ namespace MathLib
struct MatrixSpecifications
{
MatrixSpecifications(std::size_t const nrows_, std::size_t const ncols_,
SparsityPattern const*const sparsity_pattern_,
GlobalSparsityPattern const*const sparsity_pattern_,
NumLib::LocalToGlobalIndexMap const*const dof_table_,
MeshLib::Mesh const*const mesh_)
: nrows(nrows_), ncols(ncols_), sparsity_pattern(sparsity_pattern_)
......@@ -32,7 +32,7 @@ struct MatrixSpecifications
std::size_t const nrows;
std::size_t const ncols;
SparsityPattern const*const sparsity_pattern;
GlobalSparsityPattern const*const sparsity_pattern;
NumLib::LocalToGlobalIndexMap const*const dof_table;
MeshLib::Mesh const*const mesh;
};
......
......@@ -7,12 +7,12 @@
*
*/
#ifndef PROCESS_LIB_GLOBAL_SETUP_H_
#define PROCESS_LIB_GLOBAL_SETUP_H_
#ifndef NUMLIB_GLOBAL_SETUP_H_
#define NUMLIB_GLOBAL_SETUP_H_
#include <functional>
namespace ProcessLib
namespace NumLib
{
/// The GlobalSetup collects vector and matrix builder and corresponding global
......@@ -64,6 +64,6 @@ struct GlobalSetup
GlobalSetup() = delete;
};
} // namespace ProcessLib
} // namespace NumLib
#endif // PROCESS_LIB_GLOBAL_SETUP_H_
#endif // NUMLIB_GLOBAL_SETUP_H_
/**
* \copyright
* Copyright (c) 2012-2016, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef NUM_LIB_INDEXVALUEVECTOR_H
#define NUM_LIB_INDEXVALUEVECTOR_H
#include <vector>
namespace NumLib
{
template <typename IndexType>
struct IndexValueVector final
{
std::vector<IndexType> ids;
std::vector<double> values;
};
}
#endif // NUM_LIB_INDEXVALUEVECTOR_H
......@@ -12,6 +12,8 @@
#include <type_traits>
#include "MathLib/LinAlg/SparsityPattern.h"
/**
* This file provides a configuration of the global matrix/vector and
* corresponding linear solver, and the global executer types.
......@@ -105,7 +107,7 @@ using GlobalExecutorType = NumLib::SerialExecutor;
///
#include "GlobalSetup.h"
using GlobalSetupType =
ProcessLib::GlobalSetup<
NumLib::GlobalSetup<
detail::GlobalVectorMatrixBuilderType,
detail::GlobalExecutorType,
detail::LinearSolverType>;
......@@ -128,5 +130,6 @@ static_assert(std::is_same<detail::GlobalMatrixType::IndexType,
/// A type used for indexing of global vectors and matrices. It is equal to the
/// GlobalMatrixType::IndexType and the GlobalVectorType::IndexType.
using GlobalIndexType = detail::GlobalMatrixType::IndexType;
using GlobalSparsityPattern = MathLib::SparsityPattern<GlobalIndexType>;
#endif // APPLICATIONS_NUMERICSCONFIG_H_
......@@ -10,18 +10,12 @@
#ifndef NUMLIB_ODESYSTEM_H
#define NUMLIB_ODESYSTEM_H
#include "NumLib/IndexValueVector.h"
#include "NumLib/DOF/MatrixVectorTraits.h"
#include "Types.h"
#include "EquationSystem.h"
// TODO move to other namespace
namespace ProcessLib
{
template <typename IndexType>
struct DirichletBc;
}
namespace NumLib
{
......@@ -67,7 +61,7 @@ public:
//! Provides known solutions (Dirichlet boundary conditions) vector for
//! the ode system at the given time \c t.
virtual std::vector<ProcessLib::DirichletBc<Index>> const*
virtual std::vector<NumLib::IndexValueVector<Index>> const*
getKnownSolutions(double const t) const
{
(void)t;
......
......@@ -12,9 +12,9 @@
#include <memory>
#include "NumLib/DOF/UnifiedMatrixSetters.h"
#include "MathLib/LinAlg/ApplyKnownSolution.h"
#include "ProcessLib/DirichletBc.h"
#include "NumLib/IndexValueVector.h"
#include "NumLib/DOF/UnifiedMatrixSetters.h"
#include "ODESystem.h"
#include "NonlinearSystem.h"
......@@ -31,9 +31,9 @@ void applyKnownSolutions(std::vector<Solutions> const*const known_solutions,
if (!known_solutions) return;
for (auto const& bc : *known_solutions) {
for (std::size_t i=0; i<bc.global_ids.size(); ++i) {
for (std::size_t i=0; i<bc.ids.size(); ++i) {
// TODO that might have bad performance for some Vector types, e.g., PETSc.
MathLib::setVector(x, bc.global_ids[i], bc.values[i]);
MathLib::setVector(x, bc.ids[i], bc.values[i]);
}
}
}
......@@ -212,7 +212,7 @@ public:
values.resize(bc.values.size(), 0.0);
// TODO maybe it would be faster to apply all at once
MathLib::applyKnownSolution(Jac, res, minus_delta_x, bc.global_ids, values);
MathLib::applyKnownSolution(Jac, res, minus_delta_x, bc.ids, values);
}
}
}
......@@ -361,7 +361,7 @@ public:
if (known_solutions) {
for (auto const& bc : *known_solutions) {
// TODO maybe it would be faster to apply all at once
MathLib::applyKnownSolution(A, rhs, x, bc.global_ids, bc.values);
MathLib::applyKnownSolution(A, rhs, x, bc.ids, bc.values);
}
}
}
......
......@@ -12,7 +12,7 @@
#include <vector>
#include "MeshLib/MeshSearch/NodeSearch.h"
#include "NumLib/IndexValueVector.h"
namespace ProcessLib
{
......@@ -20,11 +20,7 @@ namespace ProcessLib
/// A dirichlet boundary condition is represented by a list of global indices
/// with corresponding values.
template <typename IndexType>
struct DirichletBc final
{
std::vector<IndexType> global_ids;
std::vector<double> values;
};
using DirichletBc = NumLib::IndexValueVector<IndexType>;
} // namespace ProcessLib
......
......@@ -11,7 +11,7 @@
#define PROCESS_LIB_GROUNDWATERFLOWPROCESS_FWD_H_
#include "GroundwaterFlowProcess.h"
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
extern template class ProcessLib::GroundwaterFlow::GroundwaterFlowProcess<GlobalSetupType>;
......
......@@ -320,7 +320,7 @@ protected:
private:
unsigned const _integration_order = 2;
MathLib::SparsityPattern _sparsity_pattern;
GlobalSparsityPattern _sparsity_pattern;
std::vector<DirichletBc<GlobalIndexType>> _dirichlet_bcs;
std::vector<std::unique_ptr<NeumannBc<GlobalSetup>>> _neumann_bcs;
......
......@@ -13,13 +13,12 @@
#include <algorithm>
#include <vector>
#include "logog/include/logog.hpp"
#include "NumericsConfig.h" // for GlobalIndexType
#include <logog/include/logog.hpp>
#include "BaseLib/ConfigTree.h"
#include "MeshGeoToolsLib/MeshNodeSearcher.h"
#include "NumLib/DOF/LocalToGlobalIndexMap.h"
#include "NumLib/NumericsConfig.h" // for GlobalIndexType
#include "DirichletBc.h"
......@@ -65,7 +64,7 @@ public:
std::vector<std::size_t> ids = searcher.getMeshNodeIDs(*_geometry);
// convert mesh node ids to global index for the given component
bc.global_ids.reserve(bc.global_ids.size() + ids.size());
bc.ids.reserve(bc.ids.size() + ids.size());
bc.values.reserve(bc.values.size() + ids.size());
for (auto& id : ids)
{
......@@ -82,7 +81,7 @@ public:
// PETSc routines. Therefore, the following if-condition is applied.
if (g_idx >= 0)
{
bc.global_ids.emplace_back(g_idx);
bc.ids.emplace_back(g_idx);
bc.values.emplace_back(_value);
}
}
......
......@@ -28,7 +28,7 @@
#include "MathLib/LinAlg/Dense/DenseMatrix.h"
#include "MathLib/LinAlg/FinalizeMatrixAssembly.h"
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
namespace
{
......
......@@ -27,7 +27,7 @@
#endif
#include "MathLib/LinAlg/FinalizeVectorAssembly.h"
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
namespace
{
......
......@@ -24,7 +24,7 @@
#include "NumLib/Fem/FiniteElement/TemplateIsoparametric.h"
#include "NumLib/Fem/ShapeMatrixPolicy.h"
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
#include "ProcessLib/Utils/LocalDataInitializer.h"
#include "ProcessLib/Utils/CreateLocalAssemblers.h"
#include "ProcessLib/Utils/InitShapeMatrices.h"
......
......@@ -7,7 +7,7 @@
#include "BaseLib/BuildInfo.h"
#include "NumLib/ODESolver/TimeLoopSingleODE.h"
#include "ProcessLib/NumericsConfig.h"
#include "NumLib/NumericsConfig.h"
#include "ODEs.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment