Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
keceli committed Aug 22, 2023
2 parents 25f58dd + fcd2542 commit 1719b76
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 127 deletions.
22 changes: 11 additions & 11 deletions src/python/printing/export_printing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

#pragma once
#include "../export_pluginplay.hpp"

namespace pluginplay {

void export_document_modules(py_module_reference m);

inline void export_printing(py_module_reference m) {
export_document_modules(m);
}

#pragma once
#include "../export_pluginplay.hpp"

namespace pluginplay {

void export_document_modules(py_module_reference m);

inline void export_printing(py_module_reference m) {
export_document_modules(m);
}

} // namespace pluginplay
1 change: 0 additions & 1 deletion tests/cxx/doc_snippets/force.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ namespace pluginplay_examples {
using efield_type = ElectricField;
using force_type = Force;


MODULE_CTOR(ClassicalForce) {
description(module_desc);
satisfies_property_type<force_type>();
Expand Down
2 changes: 0 additions & 2 deletions tests/cxx/doc_snippets/templated_coulombs_law.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ namespace pluginplay_examples {

using prop_type = ElectricField;



template<typename FloatingPointType>
TEMPLATED_MODULE_CTOR(TemplatedCoulombsLaw, FloatingPointType) {
description(module_desc);
Expand Down
6 changes: 3 additions & 3 deletions tests/cxx/doc_snippets/test_modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
* limitations under the License.
*/

#include <catch2/catch.hpp>
#include "modules.hpp"
#include "load_modules.hpp"
#include "electric_field.hpp"
#include "load_modules.hpp"
#include "modules.hpp"
#include <catch2/catch.hpp>

using namespace pluginplay_examples;
TEST_CASE("Tutorial modules") {
Expand Down
48 changes: 24 additions & 24 deletions tests/cxx/doc_snippets/test_tutorial_module_documents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,35 @@
#include "load_modules.hpp"

TEST_CASE("tutorial_modules_docs") {
// Need a docs path
const auto root_dir = std::filesystem::temp_directory_path();
const std::filesystem::path docs_dir("docs");
auto docs_path = root_dir / docs_dir;
// Need a docs path
const auto root_dir = std::filesystem::temp_directory_path();
const std::filesystem::path docs_dir("docs");
auto docs_path = root_dir / docs_dir;

std::filesystem::remove_all(docs_path);
std::filesystem::remove_all(docs_path);

// Create the directory
std::filesystem::create_directory(docs_path);
// Create the directory
std::filesystem::create_directory(docs_path);

// Verify the directory exists
REQUIRE(std::filesystem::exists(docs_path));
REQUIRE(std::filesystem::is_directory(docs_path));
REQUIRE(std::distance(std::filesystem::directory_iterator(docs_path),
std::filesystem::directory_iterator{}) ==
0); // Empty directory
// Verify the directory exists
REQUIRE(std::filesystem::exists(docs_path));
REQUIRE(std::filesystem::is_directory(docs_path));
REQUIRE(std::distance(std::filesystem::directory_iterator(docs_path),
std::filesystem::directory_iterator{}) ==
0); // Empty directory

// Set up module manager
pluginplay::ModuleManager mm;
// Set up module manager
pluginplay::ModuleManager mm;

SECTION("Modules Loaded") {
// Load your modules
pluginplay_examples::load_modules(mm);
SECTION("Modules Loaded") {
// Load your modules
pluginplay_examples::load_modules(mm);

// Generate module documentation at the given path
pluginplay::printing::document_modules(mm, docs_path);
// Generate module documentation at the given path
pluginplay::printing::document_modules(mm, docs_path);

REQUIRE(std::distance(std::filesystem::directory_iterator(docs_path),
std::filesystem::directory_iterator{}) ==
mm.size() + 1); // +1 for index.rst
}
REQUIRE(std::distance(std::filesystem::directory_iterator(docs_path),
std::filesystem::directory_iterator{}) ==
mm.size() + 1); // +1 for index.rst
}
}
46 changes: 23 additions & 23 deletions tests/cxx/unit_tests/pluginplay/printing/document_modules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,34 @@
#include <pluginplay/printing/document_modules.hpp>

TEST_CASE("document_modules") {
// Need a docs path
const auto root_dir = std::filesystem::temp_directory_path();
const std::filesystem::path docs_dir("docs");
auto docs_path = root_dir / docs_dir;
// Need a docs path
const auto root_dir = std::filesystem::temp_directory_path();
const std::filesystem::path docs_dir("docs");
auto docs_path = root_dir / docs_dir;

std::filesystem::remove_all(docs_path);
std::filesystem::remove_all(docs_path);

// Create the directory
std::filesystem::create_directory(docs_path);
// Create the directory
std::filesystem::create_directory(docs_path);

// Verify the directory exists
REQUIRE(std::filesystem::exists(docs_path));
REQUIRE(std::filesystem::is_directory(docs_path));
REQUIRE(std::distance(std::filesystem::directory_iterator(docs_path),
std::filesystem::directory_iterator{}) ==
0); // Empty directory
// Verify the directory exists
REQUIRE(std::filesystem::exists(docs_path));
REQUIRE(std::filesystem::is_directory(docs_path));
REQUIRE(std::distance(std::filesystem::directory_iterator(docs_path),
std::filesystem::directory_iterator{}) ==
0); // Empty directory

// Set up module manager
pluginplay::ModuleManager mm;
// Set up module manager
pluginplay::ModuleManager mm;

SECTION("Empty Module Manager") {
int correct = 1; // for index.html
SECTION("Empty Module Manager") {
int correct = 1; // for index.html

// Generate module documentation at the given path
pluginplay::printing::document_modules(mm, docs_path);
// Generate module documentation at the given path
pluginplay::printing::document_modules(mm, docs_path);

REQUIRE(std::distance(std::filesystem::directory_iterator(docs_path),
std::filesystem::directory_iterator{}) ==
correct);
}
REQUIRE(std::distance(std::filesystem::directory_iterator(docs_path),
std::filesystem::directory_iterator{}) ==
correct);
}
}
64 changes: 1 addition & 63 deletions tests/python/doc_snippets/export_pluginplay_examples.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,75 +15,13 @@
*/


// #include <pybind11/pybind11.h>
// // #include <pybind11/stl.h>
// // #include <pybind11/stl_bind.h>

// // #include "point_charge.hpp"
// // #include "templated_coulombs_law.cpp"
// // #include "screened_coulombs_law.cpp"
// // #include "force.cpp"
// // #include "modules.hpp"
// // #include <pluginplay/pluginplay.hpp>
// #include <pluginplay/plugin/plugin.hpp>

// namespace py = pybind11;

// PYBIND11_MODULE(pluginplay_examples, m) {
// m.doc() = "pybind11 bindings for pluginplay_examples";

// // Binding for Point
// //py::bind_vector<std::array<double, 3>>(m, "Point");

// // Binding for PointCharge
// py::class_<pluginplay_examples::PointCharge>(m, "PointCharge")
// .def(py::init<>())
// .def_readwrite("charge", &pluginplay_examples::PointCharge::m_charge,
// "Charge of the point")
// .def_readwrite("position", &pluginplay_examples::PointCharge::m_r,
// "Position of the point");

// EXPORT_PLUGIN(scf, m) {}

// // py::class_<pluginplay_examples::CoulombsLaw, pluginplay::ModuleBase>(
// // m, "CoulombsLaw")
// // .def(py::init<>());
// // // .def("inputs", static_cast<void
// // // (pluginplay_examples::CoulombsLaw::*)()>(&pluginplay_examples::CoulombsLaw::inputs))
// // // .def("results", &pluginplay_examples::CoulombsLaw::results);

// // // Revised Binding for TemplatedCoulombsLaw
// // py::class_<pluginplay_examples::TemplatedCoulombsLaw<float>,
// // pluginplay::ModuleBase>(m, "TemplatedCoulombsLawFloat")
// // .def(py::init<>());
// // // .def("inputs",
// // // &pluginplay_examples::TemplatedCoulombsLaw<float>::inputs)
// // // .def("results",
// // // &pluginplay_examples::TemplatedCoulombsLaw<float>::results);

// // // Revised Binding for ScreenedCoulombsLaw
// // py::class_<pluginplay_examples::ScreenedCoulombsLaw,
// // pluginplay::ModuleBase>(m, "ScreenedCoulombsLaw")
// // .def(py::init<>());
// // // .def("inputs", &pluginplay_examples::ScreenedCoulombsLaw::inputs)
// // // .def("results", &pluginplay_examples::ScreenedCoulombsLaw::results);

// // // Revised Binding for ClassicalForce
// // py::class_<pluginplay_examples::ClassicalForce, pluginplay::ModuleBase>(
// // m, "ClassicalForce")
// // .def(py::init<>());
// // // .def("inputs", &pluginplay_examples::ClassicalForce::inputs)
// // // .def("results", &pluginplay_examples::ClassicalForce::results);
// }

#include <pluginplay/plugin/plugin.hpp>
#include <pybind11/pybind11.h>
#include "../../cxx/doc_snippets/load_modules.hpp"
#include <export_electric_field.hpp>


namespace pluginplay_examples {
//EXPORT_PROPERTY_TYPE(ElectricField, m);
// EXPORT_PROPERTY_TYPE(ElectricField, m);

EXPORT_PLUGIN(pluginplay_examples, m){};
// pybind11::class_<DerivedClass, BaseClass>(m, "DerivedClass");
Expand Down

0 comments on commit 1719b76

Please sign in to comment.