Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GeoModel
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GeoModelDev
GeoModel
Commits
819352d0
Commit
819352d0
authored
3 months ago
by
Johannes Junggeburth
Browse files
Options
Downloads
Patches
Plain Diff
Add GeoId caching
parent
ec785dba
No related branches found
No related tags found
2 merge requests
!401
GeoDeDuplicator - Add GeoId
,
!400
GeoDeDuplicator - Cache GeoIdentifiers & introduce a cloneVolume method
Pipeline
#9908226
skipped
Stage: step-A
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GeoModelCore/GeoModelHelpers/GeoModelHelpers/GeoDeDuplicator.h
+9
-3
9 additions, 3 deletions
...delCore/GeoModelHelpers/GeoModelHelpers/GeoDeDuplicator.h
GeoModelCore/GeoModelHelpers/src/GeoDeDuplicator.cxx
+15
-1
15 additions, 1 deletion
GeoModelCore/GeoModelHelpers/src/GeoDeDuplicator.cxx
with
24 additions
and
4 deletions
GeoModelCore/GeoModelHelpers/GeoModelHelpers/GeoDeDuplicator.h
+
9
−
3
View file @
819352d0
...
...
@@ -9,6 +9,7 @@
#include
"GeoModelKernel/GeoTransform.h"
#include
"GeoModelKernel/GeoSerialIdentifier.h"
#include
"GeoModelKernel/GeoNameTag.h"
#include
"GeoModelKernel/GeoIdentifierTag.h"
#include
"GeoModelHelpers/GeoLogVolSorter.h"
#include
"GeoModelHelpers/GeoPhysVolSorter.h"
...
...
@@ -16,7 +17,7 @@
#include
"GeoModelHelpers/TransformSorter.h"
#include
<set>
#include
<map>
#include
<
unordered_
map>
#include
<mutex>
#include
<thread>
/***
...
...
@@ -75,6 +76,7 @@ class GeoDeDuplicator {
using
GeoTrfPtr
=
GeoIntrusivePtr
<
GeoTransform
>
;
using
GeoPhysVolPtr
=
GeoIntrusivePtr
<
GeoPhysVol
>
;
using
GeoSerialIdPtr
=
GeoIntrusivePtr
<
GeoSerialIdentifier
>
;
using
GeoIdPtr
=
GeoIntrusivePtr
<
GeoIdentifierTag
>
;
using
GeoNamePtr
=
GeoIntrusivePtr
<
GeoNameTag
>
;
/** @brief Standard constructor */
...
...
@@ -104,6 +106,8 @@ class GeoDeDuplicator {
GeoNamePtr
nameTag
(
const
std
::
string
&
tagName
)
const
;
/** @brief Returns a new GeoSerial Id */
GeoSerialIdPtr
serialId
(
const
int
id
)
const
;
/** @brief Returns a new GeoIdentifier tag */
GeoIdPtr
geoId
(
const
int
id
)
const
;
/** @brief Toggles whether shape deduplication shall be enabled */
void
setShapeDeDuplication
(
bool
enable
);
...
...
@@ -125,8 +129,9 @@ class GeoDeDuplicator {
using
LogVolSet
=
std
::
set
<
GeoLogVolPtr
,
GeoLogVolSorter
>
;
using
TrfSet
=
std
::
set
<
GeoTrfPtr
,
GeoTrf
::
TransformSorter
>
;
using
ShapeSet
=
std
::
set
<
GeoShapePtr
,
GeoShapeSorter
>
;
using
SerialIdMap
=
std
::
map
<
int
,
GeoSerialIdPtr
>
;
using
NameTagMap
=
std
::
map
<
std
::
string
,
GeoNamePtr
>
;
using
SerialIdMap
=
std
::
unordered_map
<
int
,
GeoSerialIdPtr
>
;
using
GeoIdMap
=
std
::
unordered_map
<
int
,
GeoIdPtr
>
;
using
NameTagMap
=
std
::
unordered_map
<
std
::
string
,
GeoNamePtr
>
;
mutable
PhysVolSet
m_physVolStore
{};
mutable
LogVolSet
m_logVolStore
{};
...
...
@@ -136,6 +141,7 @@ class GeoDeDuplicator {
static
ShapeSet
s_shapeStore
;
static
SerialIdMap
s_serialIds
;
static
NameTagMap
s_nameTags
;
static
GeoIdMap
s_geoIds
;
mutable
std
::
mutex
m_mutex
{};
};
...
...
This diff is collapsed.
Click to expand it.
GeoModelCore/GeoModelHelpers/src/GeoDeDuplicator.cxx
+
15
−
1
View file @
819352d0
...
...
@@ -8,6 +8,7 @@ GeoDeDuplicator::TrfSet GeoDeDuplicator::s_trfStore{};
GeoDeDuplicator
::
ShapeSet
GeoDeDuplicator
::
s_shapeStore
{};
GeoDeDuplicator
::
SerialIdMap
GeoDeDuplicator
::
s_serialIds
{};
GeoDeDuplicator
::
NameTagMap
GeoDeDuplicator
::
s_nameTags
{};
GeoDeDuplicator
::
GeoIdMap
GeoDeDuplicator
::
s_geoIds
{};
namespace
{
std
::
mutex
s_mutex
{};
...
...
@@ -31,6 +32,7 @@ void GeoDeDuplicator::clearSharedCaches() {
s_shapeStore
.
clear
();
s_serialIds
.
clear
();
s_nameTags
.
clear
();
s_geoIds
.
clear
();
}
GeoDeDuplicator
::
GeoTrfPtr
...
...
@@ -86,7 +88,8 @@ GeoDeDuplicator::GeoNamePtr GeoDeDuplicator::nameTag(const std::string& tagName)
s_nameTags
.
insert
(
std
::
make_pair
(
tagName
,
newTag
));
return
newTag
;
}
GeoDeDuplicator
::
GeoSerialIdPtr
GeoDeDuplicator
::
serialId
(
const
int
id
)
const
{
GeoDeDuplicator
::
GeoSerialIdPtr
GeoDeDuplicator
::
serialId
(
const
int
id
)
const
{
std
::
lock_guard
guard
{
s_mutex
};
SerialIdMap
::
const_iterator
itr
=
s_serialIds
.
find
(
id
);
if
(
itr
!=
s_serialIds
.
end
()){
...
...
@@ -95,4 +98,15 @@ GeoDeDuplicator::GeoSerialIdPtr GeoDeDuplicator::serialId(const int id) const {
GeoSerialIdPtr
newId
=
make_intrusive
<
GeoSerialIdentifier
>
(
id
);
s_serialIds
.
insert
(
std
::
make_pair
(
id
,
newId
));
return
newId
;
}
GeoDeDuplicator
::
GeoIdPtr
GeoDeDuplicator
::
geoId
(
const
int
id
)
const
{
std
::
lock_guard
guard
{
s_mutex
};
GeoIdMap
::
const_iterator
itr
=
s_geoIds
.
find
(
id
);
if
(
itr
!=
s_geoIds
.
end
()){
return
itr
->
second
;
}
GeoIdPtr
newId
=
make_intrusive
<
GeoIdentifierTag
>
(
id
);
s_geoIds
.
insert
(
std
::
make_pair
(
id
,
newId
));
return
newId
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment