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

Renaming "AsDiagonal" -> "Todiagonal" for consistency with "Todense" #125

Merged
merged 5 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog
v0.5.0
======

* Renaming ``MatrixDiagonal::AsDiagonal`` -> ``MatrixDiagonal::Todiagonal``
to maintain API consistency.
* Adding ``Mesh::elemmap2nodemap``. Updating Python API.
* Adding ``roll`` to FineLayer
* Adding ``Mesh::centers`` and ``Mesh::defaultElementType``
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/dynamics/Elastic-VelocityVerlet/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main()

M.assemble(nodalQuad.Int_N_scalar_NT_dV(rho));

xt::xtensor<double, 1> mass = M.AsDiagonal();
xt::xtensor<double, 1> mass = M.Todiagonal();

// update in macroscopic deformation gradient

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/dynamics/Elastic-Verlet/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ int main()

M.assemble(nodalQuad.Int_N_scalar_NT_dV(rho));

xt::xtensor<double, 1> mass = M.AsDiagonal();
xt::xtensor<double, 1> mass = M.Todiagonal();

// update in macroscopic deformation gradient

Expand Down
2 changes: 1 addition & 1 deletion include/GooseFEM/MatrixDiagonal.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MatrixDiagonal {
void solve(const xt::xtensor<double, 1>& b, xt::xtensor<double, 1>& x);

// Return matrix as diagonal matrix (column)
xt::xtensor<double, 1> AsDiagonal() const;
xt::xtensor<double, 1> Todiagonal() const;

// Auto-allocation of the functions above
xt::xtensor<double, 2> Dot(const xt::xtensor<double, 2>& x) const;
Expand Down
2 changes: 1 addition & 1 deletion include/GooseFEM/MatrixDiagonal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ inline void MatrixDiagonal::solve(const xt::xtensor<double, 1>& b, xt::xtensor<d
xt::noalias(x) = m_inv * b;
}

inline xt::xtensor<double, 1> MatrixDiagonal::AsDiagonal() const
inline xt::xtensor<double, 1> MatrixDiagonal::Todiagonal() const
{
return m_A;
}
Expand Down
2 changes: 1 addition & 1 deletion include/GooseFEM/MatrixDiagonalPartitioned.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class MatrixDiagonalPartitioned {
xt::xtensor<double, 1>& b_p) const;

// Return matrix as diagonal matrix (column)
xt::xtensor<double, 1> AsDiagonal() const;
xt::xtensor<double, 1> Todiagonal() const;

// Auto-allocation of the functions above
xt::xtensor<double, 2> Dot(const xt::xtensor<double, 2>& x) const;
Expand Down
2 changes: 1 addition & 1 deletion include/GooseFEM/MatrixDiagonalPartitioned.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ inline void MatrixDiagonalPartitioned::reaction_p(
}
}

inline xt::xtensor<double, 1> MatrixDiagonalPartitioned::AsDiagonal() const
inline xt::xtensor<double, 1> MatrixDiagonalPartitioned::Todiagonal() const
{
xt::xtensor<double, 1> ret = xt::zeros<double>({m_ndof});

Expand Down
4 changes: 2 additions & 2 deletions python/MatrixDiagonal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ void init_MatrixDiagonal(py::module& m)
.def("dofs", &GooseFEM::MatrixDiagonal::dofs, "Return degrees-of-freedom")

.def(
"AsDiagonal",
&GooseFEM::MatrixDiagonal::AsDiagonal,
"Todiagonal",
&GooseFEM::MatrixDiagonal::Todiagonal,
"Return as diagonal matrix (column)")

.def(
Expand Down
4 changes: 2 additions & 2 deletions python/MatrixDiagonalPartitioned.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ void init_MatrixDiagonalPartitioned(py::module& m)
"Return prescribed degrees-of-freedom")

.def(
"AsDiagonal",
&GooseFEM::MatrixDiagonalPartitioned::AsDiagonal,
"Todiagonal",
&GooseFEM::MatrixDiagonalPartitioned::Todiagonal,
"Return as diagonal matrix (column)")

.def(
Expand Down
2 changes: 1 addition & 1 deletion test/basic/ElementHex8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ TEST_CASE("GooseFEM::ElementHex8", "ElementHex8.h")
xt::xtensor<double, 2> rho = xt::ones<double>({mesh.nelem(), quad.nip()});

mat.assemble(quad.Int_N_scalar_NT_dV(rho));
auto M = mat.AsDiagonal();
auto M = mat.Todiagonal();

REQUIRE(M.size() == vec.ndof());
REQUIRE(xt::allclose(M, 1.));
Expand Down
2 changes: 1 addition & 1 deletion test/basic/ElementQuad4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST_CASE("GooseFEM::ElementQuad4", "ElementQuad4.h")
xt::xtensor<double, 2> rho = xt::ones<double>({mesh.nelem(), quad.nip()});

mat.assemble(quad.Int_N_scalar_NT_dV(rho));
auto M = mat.AsDiagonal();
auto M = mat.Todiagonal();

REQUIRE(M.size() == vec.ndof());
REQUIRE(xt::allclose(M, 1.));
Expand Down