Skip to content
Snippets Groups Projects
Commit 6a9f3e72 authored by Emmanuel Labourasse's avatar Emmanuel Labourasse
Browse files

bug coorected

parent 45736307
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@
#include <mesh/Connectivity.hpp>
#include <mesh/IBoundaryDescriptor.hpp>
#include <mesh/IZoneDescriptor.hpp>
#include <mesh/ImplicitMeshSmoother.hpp>
#include <mesh/Mesh.hpp>
#include <mesh/MeshData.hpp>
#include <mesh/MeshDataManager.hpp>
......@@ -255,6 +256,18 @@ SchemeModule::SchemeModule()
));
this->_addBuiltinFunction("implicitSmoothMesh",
std::function(
[](std::shared_ptr<const IMesh> p_mesh,
const std::vector<std::shared_ptr<const IBoundaryConditionDescriptor>>&
bc_descriptor_list) -> std::shared_ptr<const IMesh> {
ImplicitMeshSmootherHandler handler;
return handler.getSmoothedMesh(p_mesh, bc_descriptor_list);
}
));
this->_addBuiltinFunction("smoothMesh", std::function(
[](std::shared_ptr<const IMesh> p_mesh,
......
......@@ -17,6 +17,7 @@ add_library(
GmshReader.cpp
IConnectivity.cpp
IMesh.cpp
ImplicitMeshSmoother.cpp
LogicalConnectivityBuilder.cpp
MedianDualConnectivityBuilder.cpp
MedianDualMeshBuilder.cpp
......
......@@ -169,7 +169,7 @@ class ImplicitMeshSmootherHandler::ImplicitMeshSmoother
non_zeros_free.fill(1);
non_zeros_fixed.fill(0);
for (NodeId n_id = 0; n_id < m_given_mesh.numberOfNodes(); n_id++) {
std::cout << " n_id " << n_id << "\n";
// std::cout << " n_id " << n_id << "\n";
if (is_fixed[n_id]) {
gid_node_fixed[local_fixed_id] = n_id;
for (size_t i_face = 0; i_face < node_to_face_matrix[n_id].size(); ++i_face) {
......@@ -266,9 +266,9 @@ class ImplicitMeshSmootherHandler::ImplicitMeshSmoother
// std::cout << " is_free: "
// << "\n";
// std::cout << id_free << "\n";
std::cout << "nb_free " << nb_free << " nb_fixed " << nb_fixed << "\n";
// std::cout << "nb_free " << nb_free << " nb_fixed " << nb_fixed << "\n";
Array<int> non_zeros_free{nb_free};
Array<int> non_zeros_fixed{nb_fixed};
Array<int> non_zeros_fixed{nb_free};
Array<NodeId> gid_node_free{nb_free};
Array<NodeId> gid_node_fixed{nb_fixed};
// size_t local_free_id = 0;
......@@ -283,23 +283,24 @@ class ImplicitMeshSmootherHandler::ImplicitMeshSmoother
// local_free_id++;
// }
// }
std::cout << " gid_node_fixed: "
<< "\n";
std::cout << gid_node_fixed << "\n";
std::cout << " gid_node_free: "
<< "\n";
std::cout << gid_node_free << "\n";
// std::cout << " gid_node_fixed: "
// << "\n";
// std::cout << gid_node_fixed << "\n";
// std::cout << " gid_node_free: "
// << "\n";
// std::cout << gid_node_free << "\n";
std::cout << " nb_free " << nb_free << " nb_fixed " << nb_fixed << "\n";
CRSMatrixDescriptor<double> Afree(nb_free, nb_free, non_zeros_free);
CRSMatrixDescriptor<double> Afixed(nb_free, nb_fixed, non_zeros_fixed);
LinearSolver solver;
_fillMatrix(Afree, Afixed, is_fixed, id_free, id_fixed);
std::cout << " Afree :"
<< "\n";
std::cout << Afree << "\n";
std::cout << " Afixed :"
<< "\n";
std::cout << Afixed << "\n";
// std::cout << " Afree :"
// << "\n";
// std::cout << Afree << "\n";
// std::cout << " Afixed :"
// << "\n";
// std::cout << Afixed << "\n";
Vector<double> F{nb_fixed};
CRSMatrix Mfree{Afree.getCRSMatrix()};
......@@ -311,8 +312,8 @@ class ImplicitMeshSmootherHandler::ImplicitMeshSmoother
Vector<double> X{nb_free};
Vector<double> b{nb_free};
b = Mfixed * F;
std::cout << " F " << F << "\n";
std::cout << " b " << b << "\n";
// std::cout << " F " << F << "\n";
// std::cout << " b " << b << "\n";
solver.solveLocalSystem(Mfree, X, b);
parallel_for(
m_given_mesh.numberOfNodes(), PUGS_LAMBDA(NodeId node_id) {
......
......@@ -291,20 +291,6 @@ TEST_CASE("TinyMatrix", "[algebra]")
REQUIRE(Catch::Detail::stringify(TinyMatrix<1, 1, int>(7)) == "[[7]]");
}
SECTION("checking scalarProduct")
{
TinyMatrix<3, 4, int> B(0, -1, 1, -1, 1, -1, 1, -1, 1, -1, 1, -1);
// TinyMatrix<3, 4, int> A(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
REQUIRE(scalarProduct(A, B) == -7);
}
SECTION("checking norm")
{
TinyMatrix<3, 4, int> B(0, 0, 0, -1, 1, -1, 1, -1, 1, -1, 1, -1);
// TinyMatrix<3, 4, int> A(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
REQUIRE(l2Norm(B) == 3);
}
#ifndef NDEBUG
SECTION("output with signaling NaN")
{
......@@ -355,15 +341,6 @@ TEST_CASE("TinyMatrix", "[algebra]")
}
}
}
SECTION("checking for bad initialization")
{
TinyMatrix<3, 4, int> B;
for (size_t i = 0; i < B.numberOfRows(); ++i) {
for (size_t j = 0; j < B.numberOfColumns(); ++j) {
REQUIRE(B(i, j) == std::numeric_limits<int>::max() / 2);
}
}
}
SECTION("checking scalar product") {}
#endif // NDEBUG
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment