Archived issue #0025159

Collections and common types in BVH package are named in non-conformant manner

Open CASCADEOCCT:Codingclosed29 public notes

Search issues

Description

In OCCT we have convention that name of the global class should start from name of the package where it is defined, separated and the class, separated by underscore, and normally the class is defined in the file with same name (see http://dev.opencascade.org/doc/overview/html/occt_dev_guides__coding_rules.html#occt_coding_rules_2_2).

Functionality implemented within BVH package violates this convention multiple times for collection classes and base structures. Their definition is distributed between several files like BVH_Box.lxx, BVH_Properties.lxx, BVH_Types.hxx within BVHTools namespace. Custom types are defined in structures and have public availablity (e.g. BVH_Transform::BVH_MatNt, BVHTools::MatrixOp::BVH_Mat4t). At the same time these structures itself are named in non-conformant manner (e.g. BVHTools::MatrixOp (BVH_Properties.lxx), BVHTools::CenterAxis (BVH_Box.lxx)). Definition of several types within a single header file also takes place (e.g. BVH_Transform in BVH_Properties.hxx).

File BVH_Types.hxx does not contain neither namespace nor class corresponded to the name of this header file. It defines namespace BVHTools as well as several custom types such as BVH_Vec2i, BVH_Vec3i, BVH_Vec4i, etc. Note that BVH_Vec4i is widely used in OpenGL package.

The conformance to naming conventions is crucial in many situations, e.g. automatic tools working with the code, SWIG wrapper etc. Like this, it is quite important to put BVH package in order to fit the coding rules.

Public activity

29 archived notes

Participants are labeled by their role within this record.

01Commenter 1
Just to add to the above list, some functions are declared in LXX files, e.g. BHVTools::ArrayOp is defined in BVH_Tree.lxx. This is very confusing; it is almost impossible to find something in that code as our usual practices and even common sense is disturbed, very irritating.
02Commenter 2
One general remark: the code seems to be underdocumented, e.g. I see no documentation for most of types defined in BVH_Types.*xx. Parameters of templates seem to be never documented.
03Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Thu Sep 25 10:56:30 2014 +0400

    Revise BVH types header.
04Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Thu Sep 25 11:41:25 2014 +0400

    Refactoring BVH box class.

05Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Thu Sep 25 12:14:45 2014 +0400

    Revising BVH object set.

06Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Thu Sep 25 12:54:11 2014 +0400

    Update.

07Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Thu Sep 25 14:37:21 2014 +0400

    Update.

08Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Thu Sep 25 14:49:56 2014 +0400

    0025159: Collections and common types in BVH package are named in non-conformant manner
09Commenter 9
Dear abv,

please review the patch in branch CR25159_1.
10Commenter 10
Partially reviewed in branch CR25159_1, please test. This branch includes fixes for #0025234 and #252227 which are thus also reviewed, to be tested together.

Note that not all problems reported in the bug description are eliminated. It seems to be necessary to elaborate special coding rules to apply to code heavily using templates.

One additional issue is registered as #0025314
11Commenter 11
Dear dbp,

Could you please rebase branch CR25159_1 on new master due conflicts in source code.
12Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Thu Sep 25 14:49:56 2014 +0400

    0025159: Collections and common types in BVH package are named in non-conformant manner

Author: dbp
Date: Wed Sep 24 19:32:40 2014 +0400

    0025234: Implementing LBVH builder
    
    Performs fast BVH construction using LBVH building approach. Algorithm uses spatial Morton codes to reduce the BVH construction problem to a sorting problem (radix sort -- O(N) complexity). This Linear Bounding Volume Hierarchy (LBVH) builder produces BVH trees of lower quality compared to SAH-based BVH builders but it is over an order of magnitude faster (up to 4M triangles per second).

Author: dbp
Date: Wed Sep 24 12:03:22 2014 +0400

    0025227: Visualization - optimize BVH binned builder
    BVH binned builder is used for different rendering aspects, such as view frustum culling, ray-tracing, and (in future) for selection. It is desirable to improve builder performance. This simple patch decreases BVH building time for 30-35%.
13Commenter 13
Dear apv,

patch was rebased and pushed in branch CR25159_2.
14Commenter 14
Dear Commenter 1,

There is error during branch CR25159_2 building:
Error : File BVH_Types.lxx could not be found

More information could be found by the following link:
http://jenkins-test-02.nnov.opencascade.com/user/mnt/my-views/view/CR25159_2/job/mnt-CR25159_2-master_prepare_occt_linux/2/parsed_console/

15Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Fri Oct 3 13:48:07 2014 +0400

    Fix file list in BVH package.

16Commenter 16
Dear apv,

compilation error was fixed. Plese test (branch CR25159_2).
17Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Fri Oct 3 16:40:16 2014 +0400

    Fix error in BVH_Box.

18Commenter 2
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
19Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Fri Oct 3 17:04:00 2014 +0400

    Fix error in BVH_Box.lxx.

20Commenter 20
Dear Commenter 1,

There are 5 errors during branch CR25159_2 compilation on Linux:
1. ../../../../inc/BVH_LinearBuilder.lxx:152: error: expected primary-expression before ‘const’
2. ../../../../inc/BVH_LinearBuilder.lxx:152: error: expected ‘;’ before ‘const’
3. ../../../../inc/BVH_LinearBuilder.lxx:156: error: ‘aBox’ was not declared in this scope
4. ../../../../inc/BVH_LinearBuilder.lxx:161: error: ‘aBox’ was not declared in this scope
5. ../../../../inc/BVH_LinearBuilder.lxx:182: error: ‘myLeafNodeSize’ was not declared in this scope
More information could be found by the following link:
http://jenkins-test-02.nnov.opencascade.com/user/mnt/my-views/view/CR25159_2/job/mnt-CR25159_2-master_build_occt_linux/1/parsed_console/

Moreover, 2 compilation errors are detected on MacOS:
1. [user path removed]/tools/WOK671/wok_entities/LOC/dev/CR25159-2-master-occt/inc/BVH_LinearBuilder.lxx:152:24: error: expected a qualified name after 'typename'
2. [user path removed]/tools/WOK671/wok_entities/LOC/dev/CR25159-2-master-occt/inc/BVH_LinearBuilder.lxx:182:29: error: use of undeclared identifier 'myLeafNodeSize'
More information:
http://jenkins-test-02.nnov.opencascade.com/user/mnt/my-views/view/CR25159_2/job/mnt-CR25159_2-master_prepare_build_occt_MacOS/1/parsed_console/
21Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Fri Oct 3 19:25:28 2014 +0400

    0025159: Collections and common types in BVH package are named in non-conformant manner

Author: dbp
Date: Wed Sep 24 19:32:40 2014 +0400

    0025234: Implementing LBVH builder
    
    Performs fast BVH construction using LBVH building approach. Algorithm uses spatial Morton codes to reduce the BVH construction problem to a sorting problem (radix sort -- O(N) complexity). This Linear Bounding Volume Hierarchy (LBVH) builder produces BVH trees of lower quality compared to SAH-based BVH builders but it is over an order of magnitude faster (up to 4M triangles per second).

Author: dbp
Date: Wed Sep 24 12:03:22 2014 +0400

    0025227: Visualization - optimize BVH binned builder
    BVH binned builder is used for different rendering aspects, such as view frustum culling, ray-tracing, and (in future) for selection. It is desirable to improve builder performance. This simple patch decreases BVH building time for 30-35%.
22Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: dbp
Date: Mon Oct 6 11:16:01 2014 +0400

    Fix GCC compilation errors.

23Commenter 23
Dear kgv,

please review patch corrections in branch CR25159_3.
24Commenter 24
Dear Commenter 1,

please test the patch in branch CR25159_3.
25Commenter 25
Dear Commenter 1,

Branch CR25159_3 (and products from GIT master) was compiled on Linux, Windows and MacOS platforms and tested.
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 15 (15 on master)
   Windows: 0 (0 on master)
products component:
   Linux: 11 (11 on master)
   Windows: 1 (1 on master)

Regressions/Differences:
Not detected

Testing case:
Not needed

Testing on Linux:
Total MEMORY difference: 397826608 / 398004436
Total CPU difference: 46360.77000000022 / 47309.68000000025

Testing on Windows:
Total MEMORY difference: 278176200 / 278287368
Total CPU difference: 35521.453125 / 32988.859375
26Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
27Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
28Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
29Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]

Related records