Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make fem::Form stateless #1168

Merged
merged 53 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
4dce1ab
Remove Form setters
garth-wells Oct 15, 2020
5a386ee
Interface updates
garth-wells Oct 15, 2020
88d9883
Doc fixes
garth-wells Oct 15, 2020
3281d3a
Comment out some methods
garth-wells Oct 15, 2020
8146047
More updates
garth-wells Oct 15, 2020
75ac525
Form constructor updates
garth-wells Oct 15, 2020
067f1e1
Add missing line
garth-wells Oct 15, 2020
16440d7
Work around
garth-wells Oct 15, 2020
dc07ca4
Disable test
garth-wells Oct 15, 2020
e1bc268
Remove orig coeff code
garth-wells Oct 16, 2020
14e6f0b
Comment unused code
garth-wells Oct 16, 2020
082f7cc
More removals
garth-wells Oct 16, 2020
a5d5c7a
Sort out form coefficients by name
garth-wells Oct 16, 2020
a503f28
Remove FormCoefficients
garth-wells Oct 16, 2020
87d26fd
Fix doc
garth-wells Oct 16, 2020
1a5b433
Remove commented code
garth-wells Oct 16, 2020
3a38286
Test updates
garth-wells Oct 16, 2020
27de1e2
Update demo
garth-wells Oct 16, 2020
fa9234d
Simplify constants in forms
garth-wells Oct 16, 2020
aff3490
Remove commented code
garth-wells Oct 16, 2020
f43a131
Doc fixes
garth-wells Oct 16, 2020
0c33df0
Pass mesh to Form constructor
garth-wells Oct 16, 2020
2cfc7d7
Make Form integrals stateless
garth-wells Oct 17, 2020
6171d8a
Flake8 fixes
garth-wells Oct 17, 2020
145fe9e
Syntax fixes
garth-wells Oct 17, 2020
b05b21d
Pass subdomain to Form constructor
garth-wells Oct 19, 2020
0c29994
Update demo
garth-wells Oct 19, 2020
01ecda5
Test update
garth-wells Oct 19, 2020
8d14193
Pass subdomains to form constructor
garth-wells Oct 19, 2020
e8fffcd
Flake8 fix
garth-wells Oct 19, 2020
74f2071
Doc fix
garth-wells Oct 19, 2020
4f50899
Update demos
garth-wells Oct 19, 2020
0dbdf6e
Simplifications
garth-wells Oct 19, 2020
d30d0f6
Remove FormIntegrals
garth-wells Oct 19, 2020
a86317e
Update demo
garth-wells Oct 19, 2020
57b0609
Add some comments
garth-wells Oct 19, 2020
cb13436
Small simplifications
garth-wells Oct 19, 2020
5144772
Remove some weird spaces
garth-wells Oct 19, 2020
1b110b8
Fix year
garth-wells Oct 19, 2020
59fd493
Flake8 white space fix
garth-wells Oct 19, 2020
fe4d3b6
Merge branch 'master' into garth/form-constructor
garth-wells Oct 19, 2020
dccafcf
Formatting fixes
garth-wells Oct 19, 2020
2f73923
Fix some code comments
garth-wells Oct 20, 2020
d91e6e9
Remove a Form member function
garth-wells Oct 20, 2020
bb50c80
Fix code string
garth-wells Oct 20, 2020
82207f1
Improve coefficient and constant form checking
garth-wells Oct 20, 2020
4febd64
Simplify Form constructor (pybind11)
garth-wells Oct 20, 2020
e21e2e9
Add and use move constructors
garth-wells Oct 20, 2020
4fafa9f
Undo form constructor change (pybind11)
garth-wells Oct 20, 2020
c546f70
Remove stray character
garth-wells Oct 20, 2020
f62421c
Merge branch 'master' into garth/form-constructor
garth-wells Oct 21, 2020
36d0d7c
Minor doc improvements
garth-wells Oct 21, 2020
8f1114d
Merge branch 'garth/form-constructor' of github.com:FEniCS/dolfinx in…
garth-wells Oct 21, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cpp/demo/hyperelasticity/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ int main(int argc, char* argv[])
// Define solution function
auto u = std::make_shared<function::Function<PetscScalar>>(V);

auto a
= fem::create_form<PetscScalar>(create_form_hyperelasticity_J, {V, V});
auto L = fem::create_form<PetscScalar>(create_form_hyperelasticity_F, {V});
auto a = fem::create_form<PetscScalar>(create_form_hyperelasticity_J,
{V, V}, {{"u", u}}, {}, {});
auto L = fem::create_form<PetscScalar>(create_form_hyperelasticity_F, {V},
{{"u", u}}, {}, {});

auto u_rotation = std::make_shared<function::Function<PetscScalar>>(V);
u_rotation->interpolate([](auto& x) {
Expand Down Expand Up @@ -165,9 +166,6 @@ int main(int argc, char* argv[])
Eigen::RowMajor>::Zero(3, x.cols());
});

L->set_coefficients({{"u", u}});
a->set_coefficients({{"u", u}});

// Create Dirichlet boundary conditions
auto u0 = std::make_shared<function::Function<PetscScalar>>(V);

Expand Down
16 changes: 8 additions & 8 deletions cpp/demo/poisson/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,18 @@ int main(int argc, char* argv[])
//
// .. code-block:: cpp

// Define variational forms
auto a = fem::create_form<PetscScalar>(create_form_poisson_a, {V, V});
auto L = fem::create_form<PetscScalar>(create_form_poisson_L, {V});
// Prepare and set Constants for the bilinear form
auto kappa = std::make_shared<function::Constant<PetscScalar>>(2.0);

auto f = std::make_shared<function::Function<PetscScalar>>(V);
auto g = std::make_shared<function::Function<PetscScalar>>(V);

// Define variational forms
auto a = fem::create_form<PetscScalar>(create_form_poisson_a, {V, V}, {},
{{"kappa", kappa}}, {});
auto L = fem::create_form<PetscScalar>(create_form_poisson_L, {V},
{{"f", f}, {"g", g}}, {}, {});

// Now, the Dirichlet boundary condition (:math:`u = 0`) can be created
// using the class :cpp:class:`DirichletBC`. A :cpp:class:`DirichletBC`
// takes two arguments: the value of the boundary condition,
Expand Down Expand Up @@ -173,11 +178,6 @@ int main(int argc, char* argv[])
});

g->interpolate([](auto& x) { return Eigen::sin(5 * x.row(0)); });
L->set_coefficients({{"f", f}, {"g", g}});

// Prepare and set Constants for the bilinear form
auto kappa = std::make_shared<function::Constant<PetscScalar>>(2.0);
a->set_constants({{"kappa", kappa}});

// Now, we have specified the variational forms and can consider the
// solution of the variational problem. First, we need to define a
Expand Down
2 changes: 0 additions & 2 deletions cpp/dolfinx/fem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ set(HEADERS_fem
${CMAKE_CURRENT_SOURCE_DIR}/utils.h
${CMAKE_CURRENT_SOURCE_DIR}/FiniteElement.h
${CMAKE_CURRENT_SOURCE_DIR}/Form.h
${CMAKE_CURRENT_SOURCE_DIR}/FormCoefficients.h
${CMAKE_CURRENT_SOURCE_DIR}/FormIntegrals.h
${CMAKE_CURRENT_SOURCE_DIR}/ReferenceCellGeometry.h
${CMAKE_CURRENT_SOURCE_DIR}/SparsityPatternBuilder.h
PARENT_SCOPE)
Expand Down
Loading