Skip to content

Commit f11b857

Browse files
committed
Compiles
1 parent 8cfa966 commit f11b857

File tree

28 files changed

+298
-238
lines changed

28 files changed

+298
-238
lines changed

examples/Misc/RS2023/Conductivity/Simulation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
*/
77
#include <chrono>
88
#include <fstream>
9+
#include <Rodin/Assembly.h>
910
#include <Rodin/Solver.h>
1011
#include <Rodin/Geometry.h>
11-
#include <Rodin/Assembly.h>
1212
#include <Rodin/Variational.h>
1313

1414
using namespace Rodin;

examples/Misc/RS2023/Helmholtz/NoScreen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#include <thread>
88
#include <chrono>
99
#include <fstream>
10-
#include <Rodin/Solver.h>
1110
#include <Rodin/Assembly.h>
11+
#include <Rodin/Solver.h>
1212
#include <Rodin/Geometry.h>
1313
#include <Rodin/Variational.h>
1414

src/Rodin/Assembly.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#ifndef RODIN_ASSEMBLY_H
22
#define RODIN_ASSEMBLY_H
33

4-
#include "Assembly/Default.h"
54
#include "Assembly/Generic.h"
65
#include "Assembly/Sequential.h"
76
#include "Assembly/AssemblyBase.h"
@@ -10,5 +9,7 @@
109
#include "Assembly/OpenMP.h"
1110
#endif
1211

12+
#include "Assembly/Default.h"
13+
1314
#endif
1415

src/Rodin/Assembly/Default.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef RODIN_ASSEMBLY_DEFAULT_H
22
#define RODIN_ASSEMBLY_DEFAULT_H
33

4+
#include "Rodin/Configure.h"
5+
46
#include "Rodin/Context/Local.h"
57

68
#include "ForwardDecls.h"

src/Rodin/Assembly/Generic.h

Lines changed: 69 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,27 @@ namespace Rodin::Assembly
2121
: public AssemblyBase<LinearSystem, Variational::Problem<LinearSystem, TrialFunction, TestFunction>>
2222
{
2323
public:
24-
using LinearSystemType = LinearSystem;
24+
using LinearSystemType =
25+
LinearSystem;
2526

2627
using TrialFESType =
2728
typename FormLanguage::Traits<TrialFunction>::FESType;
2829

2930
using TestFESType =
3031
typename FormLanguage::Traits<TestFunction>::FESType;
3132

33+
using TrialFESMeshType =
34+
typename FormLanguage::Traits<TrialFESType>::MeshType;
35+
36+
using TestFESMeshType =
37+
typename FormLanguage::Traits<TestFESType>::MeshType;
38+
39+
using TrialFESMeshContextType =
40+
typename FormLanguage::Traits<TrialFESMeshType>::ContextType;
41+
42+
using TestFESMeshContextType =
43+
typename FormLanguage::Traits<TestFESMeshType>::ContextType;
44+
3245
using OperatorType =
3346
typename FormLanguage::Traits<LinearSystemType>::OperatorType;
3447

@@ -41,17 +54,19 @@ namespace Rodin::Assembly
4154
using SolutionType =
4255
typename FormLanguage::Traits<TrialFunction>::SolutionType;
4356

44-
using LinearFormType =
45-
Variational::LinearForm<TestFESType, VectorType>;
46-
47-
using DirichletBCType =
48-
Variational::DirichletBC<TrialFunction, VectorType>;
49-
5057
using BilinearFormType =
5158
Variational::BilinearForm<SolutionType, TrialFESType, TestFESType, OperatorType>;
5259

53-
using LinearFormIntegratorBaseListType =
54-
FormLanguage::List<Variational::LinearFormIntegratorBase<ScalarType>>;
60+
using BilinearFormAssemblyType =
61+
typename Assembly::Default<TrialFESMeshContextType, TestFESMeshContextType>
62+
::template Type<OperatorType, BilinearFormType>;
63+
64+
using LinearFormType =
65+
Variational::LinearForm<TestFESType, VectorType>;
66+
67+
using LinearFormAssemblyType =
68+
typename Assembly::Default<TestFESMeshContextType>
69+
::template Type<VectorType, LinearFormType>;
5570

5671
using Parent =
5772
AssemblyBase<LinearSystem, Variational::Problem<LinearSystem, TrialFunction, TestFunction>>;
@@ -71,65 +86,57 @@ namespace Rodin::Assembly
7186

7287
void execute(LinearSystem& out, const InputType& input) const override
7388
{
74-
// const auto& u = input.getTrialFunction();
75-
// const auto& v = input.getTestFunction();
76-
// const auto& trialFES = u.getFiniteElementSpace();
77-
// const auto& testFES = v.getFiniteElementSpace();
78-
// auto& pb = input.getProblemBody();
79-
// auto& [stiffness, solution, mass] = out;
80-
81-
// m_bfa.execute(stiffness, { u.getFiniteElementSpace(), v.getFiniteElementSpace(), pb.getLocalBFIs(), pb.getGlobalBFIs() });
82-
// for (auto& bf : pb.getBFs())
83-
// stiffness += bf.getOperator();
84-
85-
// m_lfa.execute(mass, { v.getFiniteElementSpace(), pb.getLFIs() });
86-
// mass *= -1;
87-
88-
// for (auto& dbc : pb.getDBCs())
89-
// {
90-
// dbc.assemble();
91-
// const auto& dofs = dbc.getDOFs();
92-
// if (dbc.isComponent())
93-
// {
94-
// assert(false);
95-
// }
96-
// else
97-
// {
98-
// out.eliminate(dofs);
99-
// }
100-
// }
101-
102-
// if (trialFES == testFES)
103-
// {
104-
// for (auto& pbc : pb.getPBCs())
105-
// {
106-
// pbc.assemble();
107-
// const auto& dofs = pbc.getDOFs();
108-
109-
// if (pbc.isComponent())
110-
// {
111-
// assert(false);
112-
// }
113-
// else
114-
// {
115-
// out.merge(dofs);
116-
// }
117-
// }
118-
// }
119-
// else
120-
// {
121-
// assert(false); // Not handled yet
122-
// }
89+
const auto& u = input.getTrialFunction();
90+
const auto& v = input.getTestFunction();
91+
const auto& trialFES = u.getFiniteElementSpace();
92+
const auto& testFES = v.getFiniteElementSpace();
93+
auto& pb = input.getProblemBody();
94+
auto& [stiffness, solution, mass] = out;
95+
96+
const BilinearFormAssemblyType bfa;
97+
bfa.execute(
98+
stiffness,
99+
{
100+
u.getFiniteElementSpace(),
101+
v.getFiniteElementSpace(),
102+
pb.getLocalBFIs(),
103+
pb.getGlobalBFIs()
104+
});
105+
106+
for (auto& bf : pb.getBFs())
107+
stiffness += bf.getOperator();
108+
109+
const LinearFormAssemblyType lfa;
110+
lfa.execute(
111+
mass,
112+
{
113+
v.getFiniteElementSpace(),
114+
pb.getLFIs()
115+
});
116+
117+
for (const auto& lf : pb.getLFs())
118+
mass += lf.getVector();
119+
120+
mass *= -1;
121+
122+
for (auto& dbc : pb.getDBCs())
123+
{
124+
dbc.assemble();
125+
out.eliminate(dbc.getDOFs());
126+
}
127+
128+
for (auto& pbc : pb.getPBCs())
129+
{
130+
assert(trialFES == testFES);
131+
pbc.assemble();
132+
out.merge(pbc.getDOFs());
133+
}
123134
}
124135

125136
Generic* copy() const noexcept override
126137
{
127138
return new Generic(*this);
128139
}
129-
130-
private:
131-
// Default<Context::Local>::Type<VectorType, LinearFormType> m_lfa;
132-
// Default<Context::Local>::Type<OperatorType, BilinearFormType> m_bfa;
133140
};
134141
}
135142

src/Rodin/Assembly/Input.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#ifndef RODIN_ASSEMBLY_INPUT_H
88
#define RODIN_ASSEMBLY_INPUT_H
99

10+
#include <functional>
11+
1012
#include "Rodin/Math.h"
1113
#include "Rodin/Tuple.h"
1214

@@ -17,7 +19,6 @@
1719

1820
#include "ForwardDecls.h"
1921
#include "Rodin/Variational/LinearFormIntegrator.h"
20-
#include <functional>
2122

2223
namespace Rodin::Assembly
2324
{

src/Rodin/PETSc/Assembly/MPI.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
namespace Rodin::Assembly
1616
{
1717
template <class FES>
18-
class MPI<PETSc::Vector, Variational::LinearForm<FES, PETSc::Vector>> final
18+
class MPI<PETSc::Math::Vector, Variational::LinearForm<FES, PETSc::Math::Vector>> final
1919
: public AssemblyBase<
20-
PETSc::Vector, Variational::LinearForm<FES, PETSc::Vector>>
20+
PETSc::Math::Vector, Variational::LinearForm<FES, PETSc::Math::Vector>>
2121
{
2222
public:
2323
using ScalarType = typename FormLanguage::Traits<FES>::ScalarType;
2424
static_assert(
2525
std::is_same_v<ScalarType, PetscScalar>,
2626
"FES::ScalarType must be PetscScalar"
2727
);
28-
using VectorType = PETSc::Vector;
28+
using VectorType = PETSc::Math::Vector;
2929
using LinearFormType = Variational::LinearForm<FES, VectorType>;
3030
using Parent = AssemblyBase<VectorType, LinearFormType>;
3131
using InputType = typename Parent::InputType;
@@ -76,8 +76,8 @@ namespace Rodin::Assembly
7676
};
7777

7878
template <class Solution, class TrialFES, class TestFES>
79-
class MPI<PETSc::Matrix, Variational::BilinearForm<Solution, TrialFES, TestFES, PETSc::Matrix>> final
80-
: public AssemblyBase<PETSc::Matrix, Variational::BilinearForm<Solution, TrialFES, TestFES, PETSc::Matrix>>
79+
class MPI<PETSc::Math::Matrix, Variational::BilinearForm<Solution, TrialFES, TestFES, PETSc::Math::Matrix>> final
80+
: public AssemblyBase<PETSc::Math::Matrix, Variational::BilinearForm<Solution, TrialFES, TestFES, PETSc::Math::Matrix>>
8181
{
8282
public:
8383
using DotType =
@@ -88,7 +88,7 @@ namespace Rodin::Assembly
8888
std::is_same_v<DotType, PetscScalar>,
8989
"DotType must be PetscScalar"
9090
);
91-
using OperatorType = PETSc::Matrix;
91+
using OperatorType = PETSc::Math::Matrix;
9292
using BilinearFormType = Variational::BilinearForm<Solution, TrialFES, TestFES, OperatorType>;
9393
using Parent = AssemblyBase<OperatorType, BilinearFormType>;
9494
using InputType = typename Parent::InputType;
@@ -151,7 +151,7 @@ namespace Rodin::Assembly
151151
};
152152
}
153153

154-
namespace Rodin::PETSc::Assembly
154+
namespace Rodin::PETSc::Math::Assembly
155155
{
156156
template <class LinearAlgebraType, class Operand>
157157
using MPI = Rodin::Assembly::MPI<LinearAlgebraType, Operand>;

src/Rodin/PETSc/Assembly/Sequential.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ namespace Rodin::Assembly
1919
{
2020
// Sequential assembly for PETSc Vec (linear form)
2121
template <class FES>
22-
class Sequential<PETSc::Vector, Variational::LinearForm<FES, PETSc::Vector>> final
23-
: public AssemblyBase<PETSc::Vector, Variational::LinearForm<FES, PETSc::Vector>>
22+
class Sequential<PETSc::Math::Vector, Variational::LinearForm<FES, PETSc::Math::Vector>> final
23+
: public AssemblyBase<PETSc::Math::Vector, Variational::LinearForm<FES, PETSc::Math::Vector>>
2424
{
2525
public:
2626
using ScalarType = typename FormLanguage::Traits<FES>::ScalarType;
27-
using VectorType = PETSc::Vector;
27+
using VectorType = PETSc::Math::Vector;
2828
using LinearFormType = Variational::LinearForm<FES, VectorType>;
2929
using Parent = AssemblyBase<VectorType, LinearFormType>;
3030
using InputType = typename Parent::InputType;
@@ -68,15 +68,15 @@ namespace Rodin::Assembly
6868

6969
// Sequential assembly for PETSc Mat (bilinear form)
7070
template <class Solution, class TrialFES, class TestFES>
71-
class Sequential<PETSc::Matrix, Variational::BilinearForm<Solution, TrialFES, TestFES, PETSc::Matrix>> final
72-
: public AssemblyBase<PETSc::Matrix, Variational::BilinearForm<Solution, TrialFES, TestFES, PETSc::Matrix>>
71+
class Sequential<PETSc::Math::Matrix, Variational::BilinearForm<Solution, TrialFES, TestFES, PETSc::Math::Matrix>> final
72+
: public AssemblyBase<PETSc::Math::Matrix, Variational::BilinearForm<Solution, TrialFES, TestFES, PETSc::Math::Matrix>>
7373
{
7474
public:
7575
using DotType =
7676
typename FormLanguage::Dot<
7777
typename FormLanguage::Traits<TrialFES>::ScalarType,
7878
typename FormLanguage::Traits<TestFES>::ScalarType>::Type;
79-
using OperatorType = PETSc::Matrix;
79+
using OperatorType = PETSc::Math::Matrix;
8080
using BilinearFormType = Variational::BilinearForm<Solution, TrialFES, TestFES, OperatorType>;
8181
using Parent = AssemblyBase<OperatorType, BilinearFormType>;
8282
using InputType = typename Parent::InputType;

src/Rodin/PETSc/IO/GridFunctionPrinter.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
#include "Rodin/FormLanguage/Traits.h"
1414

1515
#include "Rodin/PETSc/Math/Vector.h"
16-
#include <limits>
1716
#include <petscsystypes.h>
1817

1918
namespace Rodin::IO
2019
{
2120
template <FileFormat Fmt, class FES>
22-
class GridFunctionPrinter<Fmt, FES, PETSc::Vector>
23-
: public GridFunctionPrinterBase<Fmt, FES, PETSc::Vector>
21+
class GridFunctionPrinter<Fmt, FES, PETSc::Math::Vector>
22+
: public GridFunctionPrinterBase<Fmt, FES, PETSc::Math::Vector>
2423
{
2524
public:
2625
using FESType = FES;
@@ -31,7 +30,7 @@ namespace Rodin::IO
3130

3231
using ScalarType = typename FormLanguage::Traits<RangeType>::ScalarType;
3332

34-
using DataType = PETSc::Vector;
33+
using DataType = PETSc::Math::Vector;
3534

3635
using Parent = GridFunctionPrinterBase<Format, FES, DataType>;
3736

0 commit comments

Comments
 (0)