Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev-sge
Browse files Browse the repository at this point in the history
  • Loading branch information
sguionni committed Mar 11, 2024
2 parents 744fc92 + 1edcaa1 commit bbbad92
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/app/include/app/core/uid/uid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace VTX::App::Core::UID
using uid = uint;
using UIDRange = Util::Math::Range<uid>;

inline const uid INVALID_UID = std::numeric_limits<uid>::max();
inline const uid INVALID_UID = 0;
} // namespace VTX::App::Core::UID

#endif
12 changes: 11 additions & 1 deletion lib/app/include/app/core/uid/uid_registration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ namespace VTX::App::Core::UID
{
class UIDRegistration
{
private:
inline static const Util::Math::RangeList<uid> DEFAULT_RANGE_LIST()
{
Util::Math::RangeList<uid> res
= Util::Math::RangeList<uid>( { UIDRange( 0, std::numeric_limits<uid>::max() ) } );
res.removeValue( INVALID_UID );

return res;
}

public:
UIDRegistration() {};
~UIDRegistration() = default;
Expand All @@ -24,7 +34,7 @@ namespace VTX::App::Core::UID
void clear();

private:
Util::Math::RangeList<uid> _availableUIDs = Util::Math::RangeList<uid>( { UIDRange( 0, INVALID_UID - 1 ) } );
Util::Math::RangeList<uid> _availableUIDs = DEFAULT_RANGE_LIST();
std::mutex _idMutex;

uid _reserveValue();
Expand Down
2 changes: 1 addition & 1 deletion lib/app/src/app/core/uid/uid_registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace VTX::App::Core::UID
void UIDRegistration::clear()
{
std::lock_guard<std::mutex> guard( _idMutex );
_availableUIDs = Util::Math::RangeList<uid>( { UIDRange( 0, INVALID_UID - 1 ) } );
_availableUIDs = DEFAULT_RANGE_LIST();
}

uid UIDRegistration::_reserveValue()
Expand Down
2 changes: 1 addition & 1 deletion lib/renderer/bench/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ int main( int, char ** )
molecules.back()->transform
= Math::translate( molecules.back()->transform, Math::randomVec3f() * 200.f - 100.f );
IO::Util::SecondaryStructure::computeStride( *molecules.back() );
proxies.emplace_back( std::make_unique<Renderer::Proxy::Molecule>( proxify( *molecules.back() ) ) );
proxies.emplace_back( proxify( *molecules.back() ) );
renderer.addProxyMolecule( *proxies.back() );
directions.emplace_back( Math::randomVec3f() * 2.f - 1.f );
proxies.back()->onRepresentation( rand() % 4 );
Expand Down
36 changes: 21 additions & 15 deletions lib/renderer/bench/src/util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace VTX::Bench
return molecule;
}

Renderer::Proxy::Molecule proxify( const Core::Struct::Molecule & p_molecule )
std::unique_ptr<Renderer::Proxy::Molecule> proxify( const Core::Struct::Molecule & p_molecule )
{
const size_t sizeAtoms = p_molecule.trajectory.frames.front().size();
const std::vector<Core::ChemDB::Atom::SYMBOL> & symbols = p_molecule.atomSymbols;
Expand Down Expand Up @@ -87,20 +87,26 @@ namespace VTX::Bench
);
vecColorResidues.emplace_back( std::move( colorResidues ) );

return { &p_molecule.transform,
&p_molecule.trajectory.frames.front(),
&p_molecule.bondPairAtomIndexes,
&p_molecule.atomNames,
reinterpret_cast<const std::vector<uchar> *>( &p_molecule.residueSecondaryStructureTypes ),
&p_molecule.residueFirstAtomIndexes,
&p_molecule.residueAtomCounts,
&p_molecule.chainFirstResidues,
&p_molecule.chainResidueCounts,
*vecColors.back(),
*vecRadii.back(),
*vecIdAtoms.back(),
*vecColorResidues.back(),
*vecIdResidues.back() };
Renderer::Proxy::Molecule * resPtr = new Renderer::Proxy::Molecule {
&p_molecule.transform,
&p_molecule.trajectory.frames.front(),
vecColors.back().get(),
vecRadii.back().get(),
vecVisibilities.back().get(),
vecSelections.back().get(),
vecIdAtoms.back().get(),
&p_molecule.bondPairAtomIndexes,
&p_molecule.atomNames,
vecIdResidues.back().get(),
reinterpret_cast<const std::vector<uchar> *>( &p_molecule.residueSecondaryStructureTypes ),
vecColorResidues.back().get(),
&p_molecule.residueFirstAtomIndexes,
&p_molecule.residueAtomCounts,
&p_molecule.chainFirstResidues,
&p_molecule.chainResidueCounts
};

return std::unique_ptr<Renderer::Proxy::Molecule>( resPtr );
}

// Grid.
Expand Down
1 change: 0 additions & 1 deletion lib/ui/src/ui/qt/application_qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ namespace VTX::UI::QT
Core::BaseUIApplication::start( p_args );
_currentMode->enter();

_handleArgs( p_args );
_returnCode = exec();
}

Expand Down
5 changes: 2 additions & 3 deletions lib/util/include/util/callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ namespace VTX::Util
public:
using Func = std::function<void( const Args &... )>;

// Copy constructor.
// Callback() = default;
// Callback( const Callback & p_other ) { int i = 0; }
Callback() = default;
Callback( const Callback & ) = delete;

inline const Func * const add( const Func & p_callback )
{
Expand Down

0 comments on commit bbbad92

Please sign in to comment.