Skip to content

Commit

Permalink
Merge pull request #69 from BxCppDev/fix-falaise-193
Browse files Browse the repository at this point in the history
Fix falaise 193 and geomtools improvements.
  • Loading branch information
fmauger authored May 10, 2021
2 parents 0e4a839 + c7cd2b5 commit b9f23a1
Show file tree
Hide file tree
Showing 80 changed files with 2,301 additions and 912 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ include(BxVersionManager)

# - Versioning only giving major and minor. Patch number is
# automatically deduced from an external file.
bx_version_set(Bayeux 3 4)
bx_version_set(Bayeux 3 5)
message(STATUS "[info] Project version = '${PROJECT_VERSION}'")

#-----------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion cmake/BxPackageVersions.db
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
3.1.2
3.2.0
3.3.0
3.4.5
3.4.4
3.5.0
#4.0.0
# end
56 changes: 49 additions & 7 deletions release_notes.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
=============================
Bayeux 3.4.5 Release Notes
Bayeux 3.5.0 Release Notes
=============================

Bayeux 3.4.5 adds some new features as well as fixes for reported issues.
Bayeux 3.5.0 adds some new features as well as fixes for reported issues.

For information on changes made in previous versions, please see
the `release notes archive`_.
Expand All @@ -14,7 +14,7 @@ the `release notes archive`_.
Requirements
============

Bayeux 3.4.5 requires Linux (recommended Ubuntu >=18.04 (preferred
Bayeux 3.5.0 requires Linux (recommended Ubuntu >=18.04 (preferred
20.04), CentOS >=7.5), or macOS 10.


Expand All @@ -35,15 +35,15 @@ Additions
object (like in
``geomtools::model_with_internal_items_tools::plug_internal_models``).
* Add ranking features in the datatools variant system. Some dedicated
metadata are parsed from any CSV file used for large enumeration of
string values for an enumerated string parameter. A few levels of UI
auxiliary data are parsed from any CSV file used for large enumeration of
string values for an enumerated string variant parameter. A few levels of UI
ranking directives are available
(``rank=highlight|first|second|third|last``). The variant GUI now
provides a check box per variant registry panel to inhibit the
display of values of *secondary* interest in combo boxes (for string
parameters only).
* Add support for ``GNUPLOT_DRAWER_DEBUG`` environment variable for
debugging in the ``geomtools::gnuplot_drawer``.
debug print from the ``geomtools::gnuplot_drawer``.


Removals
Expand All @@ -54,7 +54,49 @@ Changes
=======

* Better support for model cleaning in ``geomtools::model_factory``.

* The interface of the ``geomtools::i_model`` abstract class has been
changed.

- the ``geomtools::i_model::_at_construct`` protected method has a
simpler signature. It does not use the model name parameter anymore,
because it was unused and confusing. All model classes have been
updated to take into account this interface change.
- the ``geomtools::i_model::_at_destroy`` and
``geomtools::i_model::destroy`` methods have been added to fullfil
some possible needs at destruction stage in some geometry models.
* The ``geomtools::simple_shaped_model`` class has been refactored for
a better management of some internals for the tube, polycone and
polyhedra shapes when using the *filled_by_envelope* mode. It is
now possible to define some envelope geometrical tolerance and
automatically generate an envelope with some margins along the main
axis of the shape (X, Y, Z, radial...), typically at submicrometer
scale in the geometry setup, to avoid rounding issues during
tracking of particle (Geant4). The envelope can be defined by
inflation (default) of the contained shape, or by deflation of the
contained shape. This experimental feature is rather tricky to use
so it will need to be checked in real situations in Geant4
(Falaise). Not all shapes can be addressed safely through this mechanism due
to the simplicity of topological approach used to build the envelope
by inflation or deflation of the contained shape.

New properties are thus available from the model configuration. By
default, none of these properties are defined and the envelope is
build with zero margin with respect to the contained shape (tube,
polycone or polyhedra) :

.. code::
filled_mode : string = "by_envelope"
envelope.tolerance.r : real as length = 0.1 um # Radial distance
envelope.tolerance.x : real as length = 0.1 um # X-axis distance
envelope.tolerance.y : real as length = 0.1 um # Y-axis distance
envelope.tolerance.z : real as length = 0.1 um # Z-axis distance
envelope.tolerance.phi : real as angle = 0.1 degree # Longitude angular tolerance
envelope.tolerance.theta : real as angle = 0.1 degree # Colatitude angular tolerance
envelope.deflated : boolean = false # Envelope defined by an inflated version
# of the contained shape outer bounds (default)
..
Fixes
=====

Expand Down
1 change: 1 addition & 0 deletions source/bxdatatools/include/datatools/properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

// This Project:
#include <datatools/datatools_config.h>
#include <datatools/utils.h>
#include <datatools/i_serializable.h>
#include <datatools/i_tree_dump.h>
#include <datatools/i_clear.h>
Expand Down
106 changes: 60 additions & 46 deletions source/bxgeomtools/include/geomtools/box.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
/// \file geomtools/box.h
/* Author(s): Francois Mauger <[email protected]>
* Creation date: 2008-05-23
* Last modified: 2015-02-15
*
* License:
* Last modified: 2021-04-24
*
* Description:
*
* Box solid shape
*
* History:
* Box 3D solid shape
*
*/

Expand Down Expand Up @@ -52,21 +48,21 @@ namespace geomtools {

/// \brief Masks used for the 6 faces of the box
enum faces_mask_type {
FACE_NONE = face_identifier::FACE_BITS_NONE,
_FACE_BEGIN = 0x1,
FACE_BACK = 0x1,
FACE_FRONT = 0x2,
FACE_LEFT = 0x4,
FACE_RIGHT = 0x8,
FACE_BOTTOM = 0x10,
FACE_TOP = 0x20,
_FACE_END = 0x40,
FACE_ALL = (FACE_BACK
| FACE_FRONT
| FACE_LEFT
| FACE_RIGHT
| FACE_BOTTOM
| FACE_TOP)
FACE_NONE = face_identifier::FACE_BITS_NONE,
_FACE_BEGIN = 0x1,
FACE_BACK = 0x1,
FACE_FRONT = 0x2,
FACE_LEFT = 0x4,
FACE_RIGHT = 0x8,
FACE_BOTTOM = 0x10,
FACE_TOP = 0x20,
_FACE_END = 0x40,
FACE_ALL = (FACE_BACK
| FACE_FRONT
| FACE_LEFT
| FACE_RIGHT
| FACE_BOTTOM
| FACE_TOP)
};

/// Return the min X coordinates (bounding box)
Expand Down Expand Up @@ -162,22 +158,40 @@ namespace geomtools {
/// Return a collection of face info objects
unsigned int compute_faces(face_info_collection_type & faces_) const override;

/// Compute a deflated version of the box
void compute_deflated(box & deflated_,
double by_x_,
double by_y_,
double by_z_);

/// Compute an inflated version of the box
void compute_inflated(box & deflated_,
double by_x_,
double by_y_,
double by_z_);

/// Compute an envelope box at user tolerance
void compute_envelope(box & envelope_,
double tolerance_x_,
double tolerance_y_,
double tolerance_z_);

/// Check if a point is inside the box
bool is_inside(const vector_3d &,
double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const override;
double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const override;

/// Check if a point is inside the box
bool is_outside(const vector_3d &,
double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const override;
double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const override;

/// Return the surface bit a point belongs to
face_identifier on_surface(const vector_3d &,
const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const override;
const face_identifier & a_surface_mask = face_identifier::face_bits_any(),
double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const override;

/// Return the vector normal to the surface at some position
vector_3d get_normal_on_surface(const vector_3d & a_position,
const face_identifier & a_surface_bit) const override;
const face_identifier & a_surface_bit) const override;

/// Print operator
friend std::ostream & operator<<( std::ostream & , const box & );
Expand All @@ -187,36 +201,36 @@ namespace geomtools {

/// Find the intercept point of a segment with the box
bool find_intercept(const vector_3d & a_from,
const vector_3d & a_direction,
face_intercept_info & a_intercept,
double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const override;
const vector_3d & a_direction,
face_intercept_info & a_intercept,
double a_skin = GEOMTOOLS_PROPER_TOLERANCE) const override;

/// Smart print
void tree_dump(std::ostream & a_out = std::clog,
const std::string & a_title = "",
const std::string & a_indent = "",
bool a_inherit = false) const override;
const std::string & a_title = "",
const std::string & a_indent = "",
bool a_inherit = false) const override;

/// \brief 3D rendering options
enum box_wires_rendering_option_type {
WR_BOX_NO_BACK_FACE = (WR_BASE_LAST << 1), //!< Do not render the X- (back) face
WR_BOX_NO_FRONT_FACE = (WR_BASE_LAST << 2), //!< Do not render the X+ (front) face
WR_BOX_NO_LEFT_FACE = (WR_BASE_LAST << 3), //!< Do not render the Y- (left) face
WR_BOX_NO_RIGHT_FACE = (WR_BASE_LAST << 4), //!< Do not render the Y+ (right) face
WR_BOX_NO_BOTTOM_FACE = (WR_BASE_LAST << 5), //!< Do not render the Z- (bottom) face
WR_BOX_NO_TOP_FACE = (WR_BASE_LAST << 6), //!< Do not render the Z+ (top) face
WR_BOX_LAST = (WR_BOX_NO_TOP_FACE), //!< Last defined bit
WR_BOX_MASK = (WR_BOX_NO_BACK_FACE
| WR_BOX_NO_FRONT_FACE
| WR_BOX_NO_LEFT_FACE
| WR_BOX_NO_RIGHT_FACE
| WR_BOX_NO_BOTTOM_FACE
| WR_BOX_NO_TOP_FACE) //!< Rendering options bit mask
WR_BOX_NO_BACK_FACE = (WR_BASE_LAST << 1), //!< Do not render the X- (back) face
WR_BOX_NO_FRONT_FACE = (WR_BASE_LAST << 2), //!< Do not render the X+ (front) face
WR_BOX_NO_LEFT_FACE = (WR_BASE_LAST << 3), //!< Do not render the Y- (left) face
WR_BOX_NO_RIGHT_FACE = (WR_BASE_LAST << 4), //!< Do not render the Y+ (right) face
WR_BOX_NO_BOTTOM_FACE = (WR_BASE_LAST << 5), //!< Do not render the Z- (bottom) face
WR_BOX_NO_TOP_FACE = (WR_BASE_LAST << 6), //!< Do not render the Z+ (top) face
WR_BOX_LAST = (WR_BOX_NO_TOP_FACE), //!< Last defined bit
WR_BOX_MASK = (WR_BOX_NO_BACK_FACE
| WR_BOX_NO_FRONT_FACE
| WR_BOX_NO_LEFT_FACE
| WR_BOX_NO_RIGHT_FACE
| WR_BOX_NO_BOTTOM_FACE
| WR_BOX_NO_TOP_FACE) //!< Rendering options bit mask
};

/// Generate a list of polylines representing the contour of the shape (for display clients)
void generate_wires_self(wires_type & wires_,
uint32_t options_ = 0) const override;
uint32_t options_ = 0) const override;

/// Compute the positions of the 8 vertexes of the box
void compute_vertexes(std::vector<vector_3d> & vv_) const;
Expand Down
23 changes: 18 additions & 5 deletions source/bxgeomtools/include/geomtools/cylinder.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/// \file geomtools/cylinder.h
/* Author(s): Francois Mauger <[email protected]>
* Creation date: 2008-05-24
* Last modified: 2015-02-15
*
* License:
* Last modified: 2021-04-24
*
* Description:
*
* A cylinder on z-axis
* A cylinder 3D solid shape on z-axis
*
*/

Expand Down Expand Up @@ -70,6 +68,21 @@ namespace geomtools {
/// Return a collection of face info objects
unsigned int compute_faces(face_info_collection_type & faces_) const override;

/// Compute a deflated version of the cylinder
void compute_deflated(cylinder & deflated_,
double by_r_,
double by_z_);

/// Compute an inflated version of the cylinder
void compute_inflated(cylinder & deflated_,
double by_r_,
double by_z_);

/// Compute an envelope cylinder at user tolerance
void compute_envelope(cylinder & envelope_,
double tolerance_r_,
double tolerance_z_);

/// Return the min X coordinates (bounding box)
double get_xmin () const override;

Expand Down Expand Up @@ -199,7 +212,7 @@ namespace geomtools {

/// Generate a list of polylines representing the contour of the shape (for display clients)
void generate_wires_self(wires_type & wires_,
uint32_t options_ = 0) const override;
uint32_t options_ = 0) const override;

/// OCD support
static void init_ocd(datatools::object_configuration_description &);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ namespace geomtools {
protected:

/// Executed at construct
void _at_construct (const std::string & name_,
const datatools::properties & config_,
models_col_type * models_ = 0) override;
void _at_construct (const datatools::properties & config_,
models_col_type * models_ = nullptr) override;

private:

Expand Down
24 changes: 16 additions & 8 deletions source/bxgeomtools/include/geomtools/detail/model_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
/* model_tools.h
* Author (s) : Francois Mauger <[email protected]>
* Creation date: 2010-02-12
* Last modified: 2010-02-12
*
* License:
*
* Description:
*
* History:
* Last modified: 2021-04-23
*
* Description: utilities and typedefs for geometry model management
*/

#ifndef GEOMTOOLS_DETAIL_MODEL_TOOLS_H
Expand All @@ -29,8 +24,21 @@ namespace geomtools {
class i_model;

/// Type alias for dictionary of geometry model plain handles
typedef std::map<std::string, i_model *> models_col_type;
typedef std::map<std::string, i_model *> models_ptr_dict_type;
// typedef std::map<std::string, i_model *> models_col_type;

// Forward declaration:
class model_factory;
struct model_bus_type : public models_ptr_dict_type
{
model_bus_type(model_factory & factory_) : _factory_(factory_) {}
const model_factory & get_factory() const { return _factory_; }
model_factory & grab_factory() const { return _factory_; }
private:
model_factory & _factory_;
};
typedef model_bus_type models_col_type;

typedef i_model * (*model_creator_type) (const std::string & name_,
const datatools::properties & configuration_,
models_col_type * models_);
Expand Down
Loading

0 comments on commit b9f23a1

Please sign in to comment.