Commit f688bc11 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Cleanup of directory structure and removed obsolete files and functions

parent 0ef5f46a
......@@ -6,7 +6,7 @@
#include <vector>
#include <dune/typetree/typetree.hh>
#include <amdis/utility/Visitor.hpp>
#include <amdis/typetree/Visitor.hpp>
namespace AMDiS
{
......@@ -119,7 +119,8 @@ namespace AMDiS
{
assert(initialized_);
assert(data_.size() > node.treeIndex());
return *(NodeData<Node>*)(data_[node.treeIndex()]);
using NodePtr = NodeData<Node>*;
return *NodePtr(data_[node.treeIndex()]);
}
//! Get reference to data associated to given node
......@@ -128,7 +129,8 @@ namespace AMDiS
{
assert(initialized_);
assert(data_.size() > node.treeIndex());
return *(NodeData<Node>*)(data_[node.treeIndex()]);
using NodePtr = NodeData<Node>*;
return *NodePtr(data_[node.treeIndex()]);
}
//! Swap tree and data container with `other`
......@@ -175,7 +177,8 @@ namespace AMDiS
{
apply([this](const auto& node, auto) {
using Node = std::remove_reference_t<decltype(node)>;
auto* p = (NodeData<Node>*)(data_[node.treeIndex()]);
using NodePtr = NodeData<Node>*;
auto* p = NodePtr(data_[node.treeIndex()]);
delete p;
});
basis_ = nullptr;
......
#pragma once
#include <dune/typetree/visitor.hh>
#include <amdis/common/Mpl.hpp>
#include <amdis/utility/Traversal.hpp>
#include <amdis/typetree/Traversal.hpp>
namespace AMDiS
{
......
#pragma once
namespace AMDiS
{
template <class ElementAssembler, class IntersectionAssembler, class BoundaryAssembler>
struct AssemblerTriple
{
ElementAssembler elementAssembler;
IntersectionAssembler intersectionAssembler;
BoundaryAssembler boundaryAssembler;
};
template <class EA, class IA, class BA>
AssemblerTriple<EA, IA, BA> makeAssemblerTriple(EA const& ea, IA const& ia, BA const& ba)
{
return {ea, ia, ba};
}
template <class GridView, class Element, class Operators, class EA, class IA, class BA>
void assembleOperators(
GridView const& gridView,
Element const& element,
Operators& operators,
AssemblerTriple<EA,IA,BA> const& assemblerTriple)
{
// assemble element operators
assemblerTriple.elementAssembler(element, operators.onElement());
// assemble intersection operators
if (!operators.onIntersection().empty()
|| (!operators.onBoundary().empty() && element.hasBoundaryIntersections()))
{
for (auto const& intersection : intersections(gridView, element)) {
if (intersection.boundary())
assemblerTriple.boundaryAssembler(intersection, operators.onBoundary());
else
assemblerTriple.intersectionAssembler(intersection, operators.onIntersection());
}
}
}
template <class Node, class ElementVector>
auto makeVectorAssembler(Node const& node, ElementVector& elementVector)
{
return makeAssemblerTriple(
[&](auto const& element, auto& operators) {
for (auto& op : operators)
op->assemble(element, node, elementVector);
},
[&](auto const& is, auto& operators) {
for (auto& op : operators)
op->assemble(is, node, elementVector);
},
[&](auto const& bis, auto& operators) {
for (auto& data : operators) {
if (data.bc.onBoundary(bis))
data.op->assemble(bis, node, elementVector);
}
});
}
template <class RowNode, class ColNode, class ElementMatrix>
auto makeMatrixAssembler(RowNode const& rowNode, ColNode const& colNode, ElementMatrix& elementMatrix)
{
return makeAssemblerTriple(
[&](auto const& element, auto& operators) {
for (auto& op : operators)
op->assemble(element, rowNode, colNode, elementMatrix);
},
[&](auto const& is, auto& operators) {
for (auto& op : operators)
op->assemble(is, rowNode, colNode, elementMatrix);
},
[&](auto const& bis, auto& operators) {
for (auto& data : operators) {
if (data.bc.onBoundary(bis))
data.op->assemble(bis, rowNode, colNode, elementMatrix);
}
});
}
} // end namespace AMDiS
\ No newline at end of file
#install headers
dune_library_add_sources(amdis SOURCES
Filesystem.cpp
)
install(FILES
ConcurrentCache.hpp
Filesystem.hpp
FiniteElementType.hpp
MultiIndex.hpp
RangeType.hpp
String.hpp
Traversal.hpp
TreeData.hpp
TreePath.hpp
Visitor.hpp
AssembleOperators.hpp
LocalBasisCache.hpp
QuadratureFactory.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amdis/utility)
......@@ -7,8 +7,8 @@
#include <dune/geometry/quadraturerules.hh>
#include <dune/geometry/type.hh>
#include <amdis/utility/ConcurrentCache.hpp>
#include <amdis/utility/FiniteElementType.hpp>
#include <amdis/common/ConcurrentCache.hpp>
#include <amdis/typetree/FiniteElementType.hpp>
namespace AMDiS
{
......
......@@ -3,7 +3,7 @@
#include <amdis/common/Literals.hpp>
#include <amdis/utility/TreePath.hpp>
#include <amdis/typetree/TreePath.hpp>
#include "Tests.hpp"
......
......@@ -2,9 +2,6 @@
dune_add_test(SOURCES AdaptInfoTest.cpp
LINK_LIBRARIES amdis)
dune_add_test(SOURCES ClonablePtrTest.cpp
LINK_LIBRARIES amdis)
dune_add_test(SOURCES ConceptsTest.cpp
LINK_LIBRARIES amdis)
......@@ -57,6 +54,3 @@ dune_add_test(SOURCES StringTest.cpp
dune_add_test(SOURCES TreeDataTest.cpp
LINK_LIBRARIES amdis)
dune_add_test(SOURCES TupleUtilityTest.cpp
LINK_LIBRARIES amdis)
// #include <iostream>
#include <amdis/common/ClonablePtr.hpp>
#include "Tests.hpp"
using namespace AMDiS;
int main()
{
using C = ClonablePtr<int>;
// constructors
C p1; // default constructor
AMDIS_TEST( !(p1) );
AMDIS_TEST( (p1.get() == nullptr) ); // same as above
int i = 10;
C p2(i); // constructor from reference
AMDIS_TEST( (p2.get() != nullptr) );
AMDIS_TEST_EQ( *p2 , i );
p1 = p2; // copy and move assignment
AMDIS_TEST( (p1.get() != nullptr) );
AMDIS_TEST_EQ( *p1 , i );
AMDIS_TEST_EQ( *p1 , *p2 );
int j = 20;
auto u = std::make_unique<int>(j);
AMDIS_TEST( (u.get() != nullptr) );
C p3(u); // constructor from std::unique_ptr
AMDIS_TEST( (u.get() == nullptr) ); // unique_ptr is reset to NULL
AMDIS_TEST( (p3.get() != nullptr) );
AMDIS_TEST_EQ( *p3 , j );
C p4(p3); // copy constructor
AMDIS_TEST( (p3.get() != nullptr) ); // ClonablePtr is not reset
AMDIS_TEST( (p4.get() != nullptr) );
AMDIS_TEST_EQ( *p4 , j );
AMDIS_TEST_EQ( *p3 , *p4 );
int k = 30;
C p5 = C::make(k); // factory method
AMDIS_TEST( (p5.get() != nullptr) );
AMDIS_TEST_EQ( *p5 , k );
C p6(*p5); // move constructor
AMDIS_TEST( (p6.get() != nullptr) );
AMDIS_TEST_EQ( *p6 , k );
AMDIS_TEST_EQ( *p5 , *p6 );
/* // Test output
std::cout << "*p1:" << *p1 << ", " << p1.get() << "\n"
<< "*p2:" << *p2 << ", " << p2.get() << "\n"
<< "*p3:" << *p3 << ", " << p3.get() << "\n"
<< "*p4:" << *p4 << ", " << p4.get() << "\n"
<< "*p5:" << *p5 << ", " << p5.get() << "\n"
<< "*p6:" << *p6 << ", " << p6.get() << "\n"
<< " u : " << u.get() << "\n"
<< " i :" << i << "\n"
<< " j :" << j << "\n"
<< " k :" << k << "\n"
<< "End of Test" << "\n";
*/
}
\ No newline at end of file
......@@ -12,36 +12,12 @@ using namespace AMDiS;
int main()
{
using V = Dune::FieldVector<double,2>;
using M = Dune::FieldMatrix<double,2,2>;
// arithmetic concepts
static_assert( Concepts::Addable<double,double>, "" );
static_assert( Concepts::Addable<V,V>, "" );
static_assert( Concepts::Addable<M,M>, "" );
static_assert( Concepts::Subtractable<double,double>, "" );
static_assert( Concepts::Subtractable<V,V>, "" );
static_assert( Concepts::Subtractable<M,M>, "" );
static_assert( Concepts::Multiplicable<double,double>, "" );
static_assert( Concepts::Multiplicable<V,double>, "" );
static_assert( Concepts::Multiplicable<V,V>, "" );
static_assert( Concepts::Multiplicable<M,double>, "" );
// static_assert( Concepts::Multiplicable<M,V>, "" ); // A*x defined but x*A is not
static_assert( Concepts::Divisible<double,double>, "" );
static_assert( Concepts::Divisible<V,double>, "" );
static_assert( Concepts::Divisible<M,double>, "" );
static_assert( Concepts::LessThanComparable<double,double>, "" );
static_assert( Concepts::LessThanComparable<char,char>, "" );
// Concepts::Callable
auto f = [](V const&) { return 0.0; };
auto b = [](V const&) { return true; };
static_assert( Concepts::Callable<decltype(f),V>, "" );
static_assert( Concepts::Evaluable<decltype(f),V>, "" );
static_assert( Concepts::Functor<decltype(f),double(V)>, "" );
static_assert( Concepts::Functor<decltype(b),bool(V)>, "" );
static_assert( Concepts::Predicate<decltype(b),V>, "" );
......
......@@ -8,7 +8,7 @@
#include <amdis/ProblemStat.hpp>
#include <amdis/gridfunctions/DiscreteFunction.hpp>
#include <amdis/gridfunctions/DOFVectorView.hpp>
#include <amdis/utility/TreePath.hpp>
#include <amdis/typetree/TreePath.hpp>
#include "Tests.hpp"
......
......@@ -5,8 +5,8 @@
#include <amdis/AMDiS.hpp>
#include <amdis/Integrate.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/common/Literals.hpp>
#include <amdis/common/FieldMatVec.hpp>
......
#include <amdis/utility/Filesystem.hpp>
#include <amdis/common/Filesystem.hpp>
#include "Tests.hpp"
......
......@@ -4,7 +4,7 @@
#include <dune/functions/functionspacebases/powerbasis.hh>
#include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <amdis/utility/FiniteElementType.hpp>
#include <amdis/typetree/FiniteElementType.hpp>
#include "Tests.hpp"
int main()
......
......@@ -3,14 +3,12 @@
#include "config.h"
#include <amdis/AMDiS.hpp>
#include <amdis/ProblemStat.hpp>
#include <amdis/Operators.hpp>
#include <amdis/assembler/ConvectionDiffusionOperator.hpp>
#include <amdis/assembler/StokesOperator.hpp>
#include <amdis/LocalOperators.hpp>
#include <amdis/localoperators/ConvectionDiffusionOperator.hpp>
#include <amdis/localoperators/StokesOperator.hpp>
using namespace AMDiS;
using Grid = Dune::YaspGrid<2>;
using Param = TaylorHoodBasis<typename Grid::LeafGridView>;
using Problem = ProblemStat<Param>;
......
......@@ -4,7 +4,7 @@
#include <dune/functions/functionspacebases/powerbasis.hh>
#include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <amdis/utility/RangeType.hpp>
#include <amdis/typetree/RangeType.hpp>
#include "Tests.hpp"
int main()
......
#include <string>
#include <vector>
#include <amdis/utility/String.hpp>
#include <amdis/common/Algorithm.hpp>
#include <amdis/common/String.hpp>
#include "Tests.hpp"
using namespace AMDiS;
......@@ -52,7 +53,7 @@ void test2()
std::string text = "Hallo Welt!";
replaceAll(text, "Welt", "du");
AMDIS_TEST_EQ(text,"Hallo du!" );
replaceAll(text, "", "Guten Tag");
AMDIS_TEST_EQ(text,"Hallo du!" );
}
......
......@@ -9,7 +9,7 @@
#include <dune/functions/functionspacebases/lagrangebasis.hh>
#include <dune/functions/functionspacebases/powerbasis.hh>
#include <amdis/utility/TreeData.hpp>
#include <amdis/typetree/TreeData.hpp>
#include "Tests.hpp"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment