Skip to content

Commit

Permalink
Move BS_thread_pool into third-party
Browse files Browse the repository at this point in the history
  • Loading branch information
cbritopacheco committed Dec 1, 2023
1 parent e27a73a commit 8828982
Show file tree
Hide file tree
Showing 12 changed files with 321 additions and 931 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ if (RODIN_BUILD_SRC)
# ---- PThreads ----
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_subdirectory(third-party/BS_thread_pool)

# ---- Boost ----
# set(Boost_USE_STATIC_LIBS OFF)
Expand Down
22 changes: 13 additions & 9 deletions examples/IntegralEquations/EquilibriumDistribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ using namespace Rodin::Variational;
inline
Scalar K(const Point& x, const Point& y)
{
return 1. / (4 * M_PI * ((x.asVector() - y.asVector()).stableNorm()));
return 1. / (4 * M_PI * (x - y).norm());
}

inline
Expand All @@ -28,27 +28,31 @@ int main(int, char**)
{
Mesh mesh;
mesh.load("D1.mesh");
// mesh.save("miaow.medit.mesh", IO::FileFormat::MEDIT);
mesh.getConnectivity().compute(1, 2);

P1 fes(mesh);

TrialFunction u(fes);
TestFunction v(fes);
Problem eq(u, v);
DenseProblem eq(u, v);
eq = Integral(Potential(K, u), v)
- Integral(v)
+ DirichletBC(u, ScalarFunction(0));
- Integral(v);

Solver::SparseLU solver;
std::cout << "assemblage\n";
eq.assemble();

std::cout << "resolution\n";
Solver::LDLT solver;
eq.solve(solver);

u.getSolution().save("u.gf");
mesh.save("u.mesh");

GridFunction phi(fes);
phi = [](const Point& p) { return 4. / (M_PI * std::sqrt(1 - p.squaredNorm())); };
phi.projectOnBoundary(ScalarFunction(0));
phi.save("phi.gf");
// GridFunction phi(fes);
// phi = [](const Point& p) { return 4. / (M_PI * std::sqrt(1 - p.squaredNorm())); };
// phi.projectOnBoundary(ScalarFunction(0));
// phi.save("phi.gf");

return 0;
}
30 changes: 7 additions & 23 deletions examples/QF/GrundmannMoller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,15 @@ using namespace Rodin::Geometry;

int main(int, char**)
{
// QF::GrundmannMoller qf(0, Polytope::Type::Triangle);
// std::cout << qf.getOrder() << std::endl;
// for (size_t i = 0; i < qf.getSize(); i++)
// {
// std::cout << "Weight:\n";
// std::cout << qf.getWeight(i) << std::endl;
// std::cout << "Point:\n" << qf.getPoint(i) << std::endl;
// }

// QF::QF1P1 qf1p1(Polytope::Type::Triangle);
// for (size_t i = 0; i < qf.getSize(); i++)
// {
// std::cout << "Weight:\n";
// std::cout << qf1p1.getWeight(i) << std::endl;
// std::cout << "Point:\n" << qf1p1.getPoint(i) << std::endl;
// }

QF::GrundmannMoller qf5(1, Polytope::Type::Triangle);
std::cout << qf5.getSize() << std::endl;
std::cout << qf5.getOrder() << std::endl;
for (size_t i = 0; i < qf5.getSize(); i++)
QF::GrundmannMoller qf(1, Polytope::Type::Triangle);
std::cout << "Order: " << qf.getOrder() << std::endl;
std::cout << "Size: " << qf.getSize() << std::endl;
for (size_t i = 0; i < qf.getSize(); i++)
{
std::cout << "Weight:\n";
std::cout << qf5.getWeight(i) << std::endl;
std::cout << "Point:\n" << qf5.getPoint(i) << std::endl;
std::cout << qf.getWeight(i) << std::endl;
std::cout << "Point:\n" << qf.getPoint(i) << std::endl;
}

return 0;
}
Loading

0 comments on commit 8828982

Please sign in to comment.