Skip to content

Commit

Permalink
Updating include paths from python package
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinGuillaume committed Jan 3, 2025
1 parent 5170872 commit 84f4c92
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 57 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __VTX_PYTHON_API_SELECTION_HELPER__
#define __VTX_PYTHON_API_SELECTION_HELPER__

#include <app/application/selection/selection.hpp>
#include <app/selection/selection.hpp>
#include <functional>
#include <optional>
#include <pybind11/pybind11.h>
Expand All @@ -13,7 +13,7 @@

namespace VTX::PythonBinding::API::Selection
{
using SelectionObj = App::Application::Selection::Selection;
using SelectionObj = App::Selection::Selection;

// Function that manage a param that can be a single T1 or a list of T1 and convert it into a vector of str
template<typename T1, typename T2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#define __VTX_PYTHON_API_SELECTION_SELECTION_INTERPRETOR__

#include "_fwd.hpp"
#include <app/application/selection/selection.hpp>
#include <app/component/chemistry/_fwd.hpp>
#include <app/selection/selection.hpp>
#include <pybind11/pybind11.h>

namespace VTX::PythonBinding::API::Selection
{
using Selection = App::Application::Selection::Selection;
using Selection = App::Selection::Selection;

class SelectionInterpretor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

#include "_fwd.hpp"
#include "python_binding/api/selection/helper.hpp"
#include <app/application/selection/selection.hpp>
#include <app/selection/selection.hpp>
#include <app/component/chemistry/_fwd.hpp>
#include <pybind11/pybind11.h>
#include <string>
#include <vector>

namespace VTX::PythonBinding::API::Selection
{
using Selection = App::Application::Selection::Selection;
using Selection = App::Selection::Selection;

class SelectionWrapper
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef __VTX_PYTHON_API_SELECTION_MOLECULE_INTERPRETOR__
#define __VTX_PYTHON_API_SELECTION_MOLECULE_INTERPRETOR__

#include <app/application/selection/selection.hpp>
#include <app/application/selection/system_data.hpp>
#include <app/selection/selection.hpp>
#include <app/selection/system_data.hpp>
#include <core/chemdb/atom.hpp>
#include <pybind11/pybind11.h>
#include <set>
Expand Down Expand Up @@ -49,31 +49,31 @@ namespace VTX::PythonBinding::API::Selection
};

public:
static void interpretSystems( App::Application::Selection::Selection &, const pybind11::kwargs & );
static void interpretSystems( App::Selection::Selection &, const pybind11::kwargs & );

private:
static std::set<App::Component::Chemistry::System *> _getSystems( const InterpretedKwargs & p_kwargs );

static void _selectChains(
const InterpretedKwargs & p_kwargs,
App::Application::Selection::SystemData & p_systemSelectionData
App::Selection::SystemData & p_systemSelectionData
);

static void _selectResidues(
const InterpretedKwargs & p_kwargs,
App::Application::Selection::SystemData & p_systemSelectionData
App::Selection::SystemData & p_systemSelectionData
);

static void _selectAtoms(
const InterpretedKwargs & p_kwargs,
App::Application::Selection::SystemData & p_systemSelectionData
App::Selection::SystemData & p_systemSelectionData
);

static void _addAtomsFollowingKwargs(
const atom_index_t p_firstAtom,
const atom_index_t p_lastAtom,
App::Component::Chemistry::System & p_system,
App::Application::Selection::SystemData & p_systemSelectionData,
App::Selection::SystemData & p_systemSelectionData,
const InterpretedKwargs & p_kwargs
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "python_binding/api/selection/selection_wrapper.hpp"
#include <app/application/scene.hpp>
#include <app/application/selection/selection_manager.hpp>
#include <app/application/selection/system_data.hpp>
#include <app/component/chemistry/atom.hpp>
#include <app/component/chemistry/chain.hpp>
#include <app/component/chemistry/residue.hpp>
#include <app/component/chemistry/system.hpp>
#include <app/component/scene/selectable.hpp>
#include <app/helper/chemistry.hpp>
#include <app/selection/selection_manager.hpp>
#include <app/selection/system_data.hpp>
#include <app/vtx_app.hpp>
#include <sstream>

Expand Down Expand Up @@ -84,9 +84,10 @@ namespace VTX::PythonBinding::API::Selection
{
App::Component::Chemistry::System & mol = *it;

const App::Application::Selection::SystemData & molSelection
//= PythonFixture::ECS_REGISTRY().getComponent<PythonFixture::Application::Selection::SystemData>( *it );
= _selection->getSelectionDataFromComponent<App::Application::Selection::SystemData>( mol
const App::Selection::SystemData & molSelection
//= PythonFixture::ECS_REGISTRY().getComponent<PythonFixture::Application::Selection::SystemData>( *it
//);
= _selection->getSelectionDataFromComponent<App::Selection::SystemData>( mol
); // TODO : is this working properly ?

for ( const size_t & chainID : molSelection.getChainIds() )
Expand All @@ -107,9 +108,10 @@ namespace VTX::PythonBinding::API::Selection
{
App::Component::Chemistry::System & mol = *it;

const App::Application::Selection::SystemData & molSelection
//= PythonFixture::ECS_REGISTRY().getComponent<PythonFixture::Application::Selection::SystemData>( *it );
= _selection->getSelectionDataFromComponent<App::Application::Selection::SystemData>( mol
const App::Selection::SystemData & molSelection
//= PythonFixture::ECS_REGISTRY().getComponent<PythonFixture::Application::Selection::SystemData>( *it
//);
= _selection->getSelectionDataFromComponent<App::Selection::SystemData>( mol
); // TODO : is this working properly ?

for ( const size_t & residueID : molSelection.getResidueIds() )
Expand All @@ -130,8 +132,8 @@ namespace VTX::PythonBinding::API::Selection
{
App::Component::Chemistry::System & mol = *it;

const App::Application::Selection::SystemData & molSelection
= _selection->getSelectionDataFromComponent<App::Application::Selection::SystemData>( mol );
const App::Selection::SystemData & molSelection
= _selection->getSelectionDataFromComponent<App::Selection::SystemData>( mol );

for ( const atom_index_t & atomID : molSelection.getAtomIds() )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace VTX::PythonBinding::API::Selection
bool SystemInterpretor::InterpretedKwargs::hasSpecifyAtom() const { return _hasAtomParams; }

void SystemInterpretor::interpretSystems(
App::Application::Selection::Selection & p_selection,
App::Selection::Selection & p_selection,
const pybind11::kwargs & p_kwargs
)
{
Expand All @@ -92,9 +92,9 @@ namespace VTX::PythonBinding::API::Selection
App::Component::Scene::Selectable & selectableComponent
= App::ECS_REGISTRY().getComponent<App::Component::Scene::Selectable>( *system );

App::Application::Selection::SystemData & systemSelectionData
= p_selection.select<App::Application::Selection::SystemData>(
selectableComponent, App::Application::Selection::AssignmentType::APPEND
App::Selection::SystemData & systemSelectionData
= p_selection.select<App::Selection::SystemData>(
selectableComponent, App::Selection::AssignmentType::APPEND
);

if ( !selectFullSystem )
Expand Down Expand Up @@ -158,7 +158,7 @@ namespace VTX::PythonBinding::API::Selection

void SystemInterpretor::_selectChains(
const InterpretedKwargs & p_kwargs,
App::Application::Selection::SystemData & p_systemSelectionData
App::Selection::SystemData & p_systemSelectionData
)
{
System & system = p_systemSelectionData.getSystem();
Expand Down Expand Up @@ -203,11 +203,11 @@ namespace VTX::PythonBinding::API::Selection

void SystemInterpretor::_selectResidues(
const InterpretedKwargs & p_kwargs,
App::Application::Selection::SystemData & p_systemSelectionData
App::Selection::SystemData & p_systemSelectionData
)
{
const System & system = p_systemSelectionData.getSystem();
const App::Application::Selection::SystemData::IndexRangeList & chainIDs
const App::Selection::SystemData::IndexRangeList & chainIDs
= p_systemSelectionData.getChainIds();

const bool selectFullResidue = !p_kwargs.hasSpecifyAtom();
Expand Down Expand Up @@ -303,17 +303,17 @@ namespace VTX::PythonBinding::API::Selection

void SystemInterpretor::_selectAtoms(
const InterpretedKwargs & p_kwargs,
App::Application::Selection::SystemData & p_systemSelectionData
App::Selection::SystemData & p_systemSelectionData
)
{
System & system = p_systemSelectionData.getSystem();

const App::Application::Selection::SystemData::IndexRangeList & residueIDs
const App::Selection::SystemData::IndexRangeList & residueIDs
= p_systemSelectionData.getResidueIds();

if ( residueIDs.isEmpty() )
{
const App::Application::Selection::SystemData::IndexRangeList & chainIDs
const App::Selection::SystemData::IndexRangeList & chainIDs
= p_systemSelectionData.getChainIds();

if ( chainIDs.isEmpty() )
Expand Down Expand Up @@ -343,7 +343,7 @@ namespace VTX::PythonBinding::API::Selection
}
else
{
const App::Application::Selection::SystemData::IndexRangeList & residueIDs
const App::Selection::SystemData::IndexRangeList & residueIDs
= p_systemSelectionData.getResidueIds();

for ( const size_t residueID : residueIDs )
Expand All @@ -368,7 +368,7 @@ namespace VTX::PythonBinding::API::Selection
const atom_index_t p_firstAtom,
const atom_index_t p_lastAtom,
System & p_system,
App::Application::Selection::SystemData & p_systemSelectionData,
App::Selection::SystemData & p_systemSelectionData,
const InterpretedKwargs & p_kwargs
)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "python_binding/api/selection/selection_interpretor.hpp"
#include "python_binding/api/selection/selection_wrapper.hpp"
#include "python_binding/api/selection/system_interpretor.hpp"
#include <app/application/selection/selection.hpp>
#include <app/selection/selection.hpp>
#include <app/component/chemistry/atom.hpp>
#include <app/component/chemistry/chain.hpp>
#include <app/component/chemistry/residue.hpp>
Expand Down Expand Up @@ -35,7 +35,7 @@ namespace VTX::PythonBinding::Binding::Binders
p_apiModule.def( "intersect", &API::Selection::SelectionWrapper::intersect );
p_apiModule.def( "exclusive", &API::Selection::SelectionWrapper::exclusive );

pybind11::class_<App::Application::Selection::Selection>(
pybind11::class_<App::Selection::Selection>(
p_apiModule, "_VTXSelection", pybind11::module_local()
);

Expand Down
2 changes: 1 addition & 1 deletion lib/python_binding/test/src/util/selection.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "selection.hpp"
#include <app/application/scene.hpp>
#include <app/application/selection/selection_manager.hpp>
#include <app/selection/selection_manager.hpp>
#include <app/core/ecs/base_entity.hpp>
#include <app/core/ecs/registry.hpp>
#include <app/vtx_app.hpp>
Expand Down
26 changes: 11 additions & 15 deletions lib/python_binding/test/src/util/selection.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef __VTX_APP_TEST_UTIL_SELECTION__
#define __VTX_APP_TEST_UTIL_SELECTION__

#include <app/application/selection/concepts.hpp>
#include <app/application/selection/selection.hpp>
#include <app/application/selection/selection_data.hpp>
#include <app/application/selection/system_data.hpp>
#include <app/selection/concepts.hpp>
#include <app/selection/selection.hpp>
#include <app/selection/selection_data.hpp>
#include <app/selection/system_data.hpp>
#include <string>
#include <util/concepts.hpp>
#include <util/math/range_list.hpp>
Expand All @@ -13,9 +13,9 @@ namespace VTX::App::Test::Util
{
class Selection
{
using SystemData = VTX::App::Application::Selection::SystemData;
using SelectionData = VTX::App::Application::Selection::SelectionData;
using SelectionObj = VTX::App::Application::Selection::Selection;
using SystemData = VTX::App::Selection::SystemData;
using SelectionData = VTX::App::Selection::SelectionData;
using SelectionObj = VTX::App::Selection::Selection;

public:
static bool checkSelection(
Expand All @@ -27,17 +27,15 @@ namespace VTX::App::Test::Util
static SelectionObj createSelection( const SelectionData & p_item );
static SelectionObj createSelection( const std::unique_ptr<SelectionData> & p_itemPtr );

template<Application::Selection::SelectionDataConcept T>
template<App::Selection::SelectionDataConcept T>
static SelectionObj createSelection( const std::initializer_list<T> & p_items )
{
SelectionObj res = SelectionObj();

for ( const T & sourceItemPtr : p_items )
{
res.select(
sourceItemPtr.getSelectionComponent(),
sourceItemPtr,
VTX::App::Application::Selection::AssignmentType::APPEND
sourceItemPtr.getSelectionComponent(), sourceItemPtr, VTX::App::Selection::AssignmentType::APPEND
);
}

Expand All @@ -52,9 +50,7 @@ namespace VTX::App::Test::Util
for ( const SelectionData * const sourceItemPtr : p_items )
{
res.select(
sourceItemPtr->getSelectionComponent(),
*sourceItemPtr,
VTX::App::Application::Selection::AssignmentType::APPEND
sourceItemPtr->getSelectionComponent(), *sourceItemPtr, VTX::App::Selection::AssignmentType::APPEND
);
}

Expand All @@ -68,5 +64,5 @@ namespace VTX::App::Test::Util
const std::vector<atom_index_t> & p_atoms = {}
);
};
} // namespace VTX::PythonFixture::Test::Util
} // namespace VTX::App::Test::Util
#endif
8 changes: 4 additions & 4 deletions lib/python_binding/test/src/vtx_api_selection.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "util/app.hpp"
#include "util/selection.hpp"
#include <app/application/scene.hpp>
#include <app/application/selection/selection_manager.hpp>
#include <app/application/selection/system_data.hpp>
#include <app/selection/selection_manager.hpp>
#include <app/selection/system_data.hpp>
#include <app/fixture.hpp>
#include <app/vtx_app.hpp>
#include <catch2/benchmark/catch_benchmark.hpp>
Expand Down Expand Up @@ -60,7 +60,7 @@ TEST_CASE( "VTX_PYTHON_BINDING - VTX API Selection Tests", "[integration]" )
*SelectionUtil::generateSystemData( "8QHQ", { 0, 6 } ) } )
) );

std::unique_ptr<App::Application::Selection::SelectionData> allHistidineOn4HHB = SelectionUtil::generateSystemData(
std::unique_ptr<App::Selection::SelectionData> allHistidineOn4HHB = SelectionUtil::generateSystemData(
"4HHB",
{},
{
Expand Down Expand Up @@ -172,7 +172,7 @@ TEST_CASE( "VTX_PYTHON_BINDING - VTX API Selection Tests", "[integration]" )
) );

CHECK( SelectionUtil::checkSelection(
"test_empty_1", "select( mol_n='Nimportequoi', chain_i=1 )", App::Application::Selection::Selection()
"test_empty_1", "select( mol_n='Nimportequoi', chain_i=1 )", App::Selection::Selection()
) );

CHECK( SelectionUtil::checkSelection(
Expand Down

0 comments on commit 84f4c92

Please sign in to comment.