Skip to content

Commit

Permalink
pre-commit autoupdate (#265)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdegeus authored Feb 26, 2024
1 parent 689d718 commit 78f16df
Show file tree
Hide file tree
Showing 13 changed files with 125 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ jobs:
- uses: actions/checkout@main
- uses: actions/setup-python@main
with:
python-version: '>=3.11'
python-version: '3.11'
- uses: pre-commit/action@main
22 changes: 11 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-toml
- id: debug-statements
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.10.0
rev: v2.12.0
hooks:
- id: pretty-format-yaml
args: [--autofix, --indent, '2']
- id: pretty-format-toml
args: [--autofix]
- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.2.0
hooks:
- id: black
args: [--safe, --quiet, --line-length=100]
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.0
hooks:
- id: autoflake
args: [--in-place, --remove-unused-variable, --remove-all-unused-imports]
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.10.0
rev: v3.12.0
hooks:
- id: reorder-python-imports
- repo: https://github.com/asottile/pyupgrade
rev: v3.9.0
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 7.0.0
hooks:
- id: flake8
args: [--max-line-length=100]
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.4.0
rev: v2.5.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/tdegeus/cpp_comment_format
rev: v0.2.0
rev: v0.2.1
hooks:
- id: cpp_comment_format
args: [-c, -t, '4']
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
rev: v17.0.6
hooks:
- id: clang-format
args: [-i]
- repo: https://github.com/tdegeus/conda_envfile
rev: v0.4.2
rev: v0.5.2
hooks:
- id: conda_envfile_parse
files: environment.yaml
3 changes: 2 additions & 1 deletion include/GooseFEM/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ class QuadratureBase {
auto shape_elemmat() const -> std::array<size_t, 3>
{
return std::array<size_t, 3>{
derived_cast().m_nelem, D::s_nne * D::s_ndim, D::s_nne * D::s_ndim};
derived_cast().m_nelem, D::s_nne * D::s_ndim, D::s_nne * D::s_ndim
};
}

/**
Expand Down
3 changes: 2 additions & 1 deletion include/GooseFEM/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ class MatrixBase {
return std::array<size_t, 3>{
derived_cast().m_nelem,
derived_cast().m_nne * derived_cast().m_ndim,
derived_cast().m_nne * derived_cast().m_ndim};
derived_cast().m_nne * derived_cast().m_ndim
};
}

/**
Expand Down
2 changes: 1 addition & 1 deletion include/GooseFEM/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ inline array_type::tensor<size_t, 2> dofs(size_t nnode, size_t ndim)
* dofs = renumber(dofs)
* sort(unique(dofs[:])) == range(max(dofs+1))
*
* \note One can use the wrapper function renumber(). This class gives more advanced features.
* @note One can use the wrapper function renumber(). This class gives more advanced features.
*/
class Renumber {
public:
Expand Down
6 changes: 4 additions & 2 deletions tests/basic/Allocate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ TEST_CASE("GooseFEM::Allocate", "Allocate.h")

xt::xtensor<int, 4> a2 = {
{{{1, 1}, {1, 1}, {1, 1}}, {{2, 2}, {2, 2}, {2, 2}}},
{{{3, 3}, {3, 3}, {3, 3}}, {{4, 4}, {4, 4}, {4, 4}}}};
{{{3, 3}, {3, 3}, {3, 3}}, {{4, 4}, {4, 4}, {4, 4}}}
};

xt::xtensor<int, 3> b1 = xt::empty<int>({2, 2, 3});
xt::xtensor<int, 4> b2 = xt::empty<int>({2, 2, 3, 2});
Expand All @@ -36,7 +37,8 @@ TEST_CASE("GooseFEM::Allocate", "Allocate.h")

xt::xtensor<int, 4> a2 = {
{{{1, 1}, {1, 1}, {1, 1}}, {{2, 2}, {2, 2}, {2, 2}}},
{{{3, 3}, {3, 3}, {3, 3}}, {{4, 4}, {4, 4}, {4, 4}}}};
{{{3, 3}, {3, 3}, {3, 3}}, {{4, 4}, {4, 4}, {4, 4}}}
};

auto b1 = GooseFEM::AsTensor<1>(a0, 3);
auto c1 = GooseFEM::AsTensor(1, a0, 3);
Expand Down
15 changes: 10 additions & 5 deletions tests/basic/Iterate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ TEST_CASE("GooseFEM::Iterate", "Iterate.h")

std::vector<double> res = {5e+0, 5e+1, 5e-1, 5e-2, 5e-3, 5e-4, 4e-4, 3e-4, 2e-4, 1e-4};
std::vector<bool> conv = {
false, false, false, false, false, false, false, false, false, true};
false, false, false, false, false, false, false, false, false, true
};

for (size_t i = 0; i < res.size(); ++i) {
residuals.roll_insert(res[i]);
Expand All @@ -28,7 +29,8 @@ TEST_CASE("GooseFEM::Iterate", "Iterate.h")

std::vector<double> res = {5e+0, 5e+1, 5e-1, 5e-2, 5e-3, 5e-4, 4e-4, 5e-4, 4e-4, 4e-4};
std::vector<bool> conv = {
false, false, false, false, false, false, false, false, false, true};
false, false, false, false, false, false, false, false, false, true
};

for (size_t i = 0; i < res.size(); ++i) {
residuals.roll_insert(res[i]);
Expand All @@ -42,7 +44,8 @@ TEST_CASE("GooseFEM::Iterate", "Iterate.h")

std::vector<double> res = {5e+0, 5e+1, 5e-1, 5e-2, 5e-3, 5e-4, 4e-4, 3e-4, 2e-4, 1e-4};
std::vector<bool> conv = {
false, false, false, false, false, false, false, false, false, true};
false, false, false, false, false, false, false, false, false, true
};

for (size_t i = 0; i < res.size(); ++i) {
residuals.roll_insert(res[i]);
Expand All @@ -55,7 +58,8 @@ TEST_CASE("GooseFEM::Iterate", "Iterate.h")
GooseFEM::Iterate::StopList residuals(5);

std::vector<double> res = {
5e+0, 5e+1, 5e-1, 5e-2, 5e-3, 5e-4, 4e-4, 3e-4, 2e-4, 3e-4, 2e-4, 1e-4, 9e-5, 8e-5};
5e+0, 5e+1, 5e-1, 5e-2, 5e-3, 5e-4, 4e-4, 3e-4, 2e-4, 3e-4, 2e-4, 1e-4, 9e-5, 8e-5
};
std::vector<bool> conv = {
false,
false,
Expand All @@ -70,7 +74,8 @@ TEST_CASE("GooseFEM::Iterate", "Iterate.h")
false,
false,
false,
true};
true
};

for (size_t i = 0; i < res.size(); ++i) {
residuals.roll_insert(res[i]);
Expand Down
3 changes: 2 additions & 1 deletion tests/basic/MatrixDiagonal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ TEST_CASE("GooseFEM::MatrixDiagonal", "MatrixDiagonal.h")
0.5,
0.5,
0.25,
0.25};
0.25
};

REQUIRE(xt::allclose(A.data(), a));
}
Expand Down
3 changes: 2 additions & 1 deletion tests/basic/MatrixDiagonalPartitioned.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ TEST_CASE("GooseFEM::MatrixDiagonalPartitioned", "MatrixDiagonalPartitioned.h")
0.5,
0.5,
0.25,
0.25};
0.25
};

REQUIRE(xt::allclose(A.data(), a));
}
Expand Down
63 changes: 42 additions & 21 deletions tests/basic/MeshHex8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ TEST_CASE("GooseFEM::MeshHex8", "MeshHex8.h")
{2., 2., 2.}, {3., 2., 2.}, {0., 3., 2.}, {1., 3., 2.}, {2., 3., 2.}, {3., 3., 2.},
{0., 0., 3.}, {1., 0., 3.}, {2., 0., 3.}, {3., 0., 3.}, {0., 1., 3.}, {1., 1., 3.},
{2., 1., 3.}, {3., 1., 3.}, {0., 2., 3.}, {1., 2., 3.}, {2., 2., 3.}, {3., 2., 3.},
{0., 3., 3.}, {1., 3., 3.}, {2., 3., 3.}, {3., 3., 3.}};
{0., 3., 3.}, {1., 3., 3.}, {2., 3., 3.}, {3., 3., 3.}
};

xt::xtensor<double, 2> conn_ = {
{0, 1, 5, 4, 16, 17, 21, 20}, {1, 2, 6, 5, 17, 18, 22, 21},
Expand All @@ -32,24 +33,30 @@ TEST_CASE("GooseFEM::MeshHex8", "MeshHex8.h")
{34, 35, 39, 38, 50, 51, 55, 54}, {36, 37, 41, 40, 52, 53, 57, 56},
{37, 38, 42, 41, 53, 54, 58, 57}, {38, 39, 43, 42, 54, 55, 59, 58},
{40, 41, 45, 44, 56, 57, 61, 60}, {41, 42, 46, 45, 57, 58, 62, 61},
{42, 43, 47, 46, 58, 59, 63, 62}};
{42, 43, 47, 46, 58, 59, 63, 62}
};

xt::xtensor<size_t, 1> nodesBottom_ = {
0, 1, 2, 3, 16, 17, 18, 19, 32, 33, 34, 35, 48, 49, 50, 51};
0, 1, 2, 3, 16, 17, 18, 19, 32, 33, 34, 35, 48, 49, 50, 51
};

xt::xtensor<size_t, 1> nodesTop_ = {
12, 13, 14, 15, 28, 29, 30, 31, 44, 45, 46, 47, 60, 61, 62, 63};
12, 13, 14, 15, 28, 29, 30, 31, 44, 45, 46, 47, 60, 61, 62, 63
};

xt::xtensor<size_t, 1> nodesLeft_ = {
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60};
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60
};

xt::xtensor<size_t, 1> nodesRight_ = {
3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63};
3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63
};

xt::xtensor<size_t, 1> nodesFront_ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};

xt::xtensor<size_t, 1> nodesBack_ = {
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63};
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63
};

xt::xtensor<size_t, 1> nodesFrontTopEdge_ = {12, 13, 14, 15};
xt::xtensor<size_t, 1> nodesFrontLeftEdge_ = {0, 4, 8, 12};
Expand Down Expand Up @@ -102,7 +109,8 @@ TEST_CASE("GooseFEM::MeshHex8", "MeshHex8.h")
{135, 136, 137}, {138, 139, 140}, {141, 142, 143}, {144, 145, 146}, {147, 148, 149},
{150, 151, 152}, {153, 154, 155}, {156, 157, 158}, {159, 160, 161}, {162, 163, 164},
{165, 166, 167}, {168, 169, 170}, {171, 172, 173}, {174, 175, 176}, {177, 178, 179},
{180, 181, 182}, {183, 184, 185}, {186, 187, 188}, {189, 190, 191}};
{180, 181, 182}, {183, 184, 185}, {186, 187, 188}, {189, 190, 191}
};

xt::xtensor<size_t, 2> dofsPeriodic_ = {
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 1, 2}, {9, 10, 11}, {12, 13, 14},
Expand All @@ -115,14 +123,16 @@ TEST_CASE("GooseFEM::MeshHex8", "MeshHex8.h")
{78, 79, 80}, {72, 73, 74}, {54, 55, 56}, {57, 58, 59}, {60, 61, 62}, {54, 55, 56},
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 1, 2}, {9, 10, 11}, {12, 13, 14},
{15, 16, 17}, {9, 10, 11}, {18, 19, 20}, {21, 22, 23}, {24, 25, 26}, {18, 19, 20},
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 1, 2}};
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 1, 2}
};

xt::xtensor<size_t, 2> nodesPeriodic_ = {
{0, 3}, {0, 51}, {0, 48}, {0, 12}, {0, 15}, {0, 63}, {0, 60}, {1, 49},
{2, 50}, {1, 61}, {2, 62}, {1, 13}, {2, 14}, {16, 19}, {32, 35}, {16, 31},
{32, 47}, {16, 28}, {32, 44}, {4, 7}, {8, 11}, {4, 55}, {8, 59}, {4, 52},
{8, 56}, {5, 53}, {6, 54}, {9, 57}, {10, 58}, {20, 23}, {24, 27}, {36, 39},
{40, 43}, {17, 29}, {18, 30}, {33, 45}, {34, 46}};
{40, 43}, {17, 29}, {18, 30}, {33, 45}, {34, 46}
};

size_t nodesOrigin_ = 0;

Expand Down Expand Up @@ -194,7 +204,8 @@ TEST_CASE("GooseFEM::MeshHex8", "MeshHex8.h")
{2., 2., 2.}, {3., 2., 2.}, {0., 2., 3.}, {1., 2., 3.}, {2., 2., 3.}, {3., 2., 3.},
{0., 3., 0.}, {1., 3., 0.}, {2., 3., 0.}, {3., 3., 0.}, {0., 3., 1.}, {1., 3., 1.},
{2., 3., 1.}, {3., 3., 1.}, {0., 3., 2.}, {1., 3., 2.}, {2., 3., 2.}, {3., 3., 2.},
{0., 3., 3.}, {1., 3., 3.}, {2., 3., 3.}, {3., 3., 3.}};
{0., 3., 3.}, {1., 3., 3.}, {2., 3., 3.}, {3., 3., 3.}
};

xt::xtensor<double, 2> conn_ = {
{0, 1, 17, 16, 4, 5, 21, 20}, {1, 2, 18, 17, 5, 6, 22, 21},
Expand All @@ -210,25 +221,32 @@ TEST_CASE("GooseFEM::MeshHex8", "MeshHex8.h")
{34, 35, 51, 50, 38, 39, 55, 54}, {36, 37, 53, 52, 40, 41, 57, 56},
{37, 38, 54, 53, 41, 42, 58, 57}, {38, 39, 55, 54, 42, 43, 59, 58},
{40, 41, 57, 56, 44, 45, 61, 60}, {41, 42, 58, 57, 45, 46, 62, 61},
{42, 43, 59, 58, 46, 47, 63, 62}};
{42, 43, 59, 58, 46, 47, 63, 62}
};

xt::xtensor<size_t, 1> nodesBottom_ = {
0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15};
0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15
};

xt::xtensor<size_t, 1> nodesTop_ = {
48, 52, 56, 60, 49, 53, 57, 61, 50, 54, 58, 62, 51, 55, 59, 63};
48, 52, 56, 60, 49, 53, 57, 61, 50, 54, 58, 62, 51, 55, 59, 63
};

xt::xtensor<size_t, 1> nodesLeft_ = {
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60};
0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60
};

xt::xtensor<size_t, 1> nodesRight_ = {
3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63};
3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63
};

xt::xtensor<size_t, 1> nodesFront_ = {
0, 1, 2, 3, 16, 17, 18, 19, 32, 33, 34, 35, 48, 49, 50, 51};
0, 1, 2, 3, 16, 17, 18, 19, 32, 33, 34, 35, 48, 49, 50, 51
};

xt::xtensor<size_t, 1> nodesBack_ = {
12, 13, 14, 15, 28, 29, 30, 31, 44, 45, 46, 47, 60, 61, 62, 63};
12, 13, 14, 15, 28, 29, 30, 31, 44, 45, 46, 47, 60, 61, 62, 63
};

xt::xtensor<size_t, 1> nodesFrontTopEdge_ = {48, 49, 50, 51};
xt::xtensor<size_t, 1> nodesFrontLeftEdge_ = {0, 16, 32, 48};
Expand Down Expand Up @@ -281,7 +299,8 @@ TEST_CASE("GooseFEM::MeshHex8", "MeshHex8.h")
{135, 136, 137}, {138, 139, 140}, {141, 142, 143}, {144, 145, 146}, {147, 148, 149},
{150, 151, 152}, {153, 154, 155}, {156, 157, 158}, {159, 160, 161}, {162, 163, 164},
{165, 166, 167}, {168, 169, 170}, {171, 172, 173}, {174, 175, 176}, {177, 178, 179},
{180, 181, 182}, {183, 184, 185}, {186, 187, 188}, {189, 190, 191}};
{180, 181, 182}, {183, 184, 185}, {186, 187, 188}, {189, 190, 191}
};

xt::xtensor<size_t, 2> dofsPeriodic_ = {
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 1, 2}, {9, 10, 11}, {12, 13, 14},
Expand All @@ -294,14 +313,16 @@ TEST_CASE("GooseFEM::MeshHex8", "MeshHex8.h")
{78, 79, 80}, {72, 73, 74}, {54, 55, 56}, {57, 58, 59}, {60, 61, 62}, {54, 55, 56},
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 1, 2}, {9, 10, 11}, {12, 13, 14},
{15, 16, 17}, {9, 10, 11}, {18, 19, 20}, {21, 22, 23}, {24, 25, 26}, {18, 19, 20},
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 1, 2}};
{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 1, 2}
};

xt::xtensor<size_t, 2> nodesPeriodic_ = {
{0, 3}, {0, 15}, {0, 12}, {0, 48}, {0, 51}, {0, 63}, {0, 60}, {1, 13},
{2, 14}, {1, 61}, {2, 62}, {1, 49}, {2, 50}, {4, 7}, {8, 11}, {4, 55},
{8, 59}, {4, 52}, {8, 56}, {16, 19}, {32, 35}, {16, 31}, {32, 47}, {16, 28},
{32, 44}, {17, 29}, {18, 30}, {33, 45}, {34, 46}, {20, 23}, {24, 27}, {36, 39},
{40, 43}, {5, 53}, {9, 57}, {6, 54}, {10, 58}};
{40, 43}, {5, 53}, {9, 57}, {6, 54}, {10, 58}
};

size_t nodesOrigin_ = 0;

Expand Down
Loading

0 comments on commit 78f16df

Please sign in to comment.