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
c8364ca3
Commit
c8364ca3
authored
2 months ago
by
Johannes Junggeburth
Browse files
Options
Downloads
Patches
Plain Diff
Extend poly edges
parent
412b99cf
No related branches found
No related tags found
1 merge request
!391
Extend poly edges
Pipeline
#9857927
passed
2 months ago
Stage: step-A
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GeoModelCore/GeoModelHelpers/src/GeoShapeUtils.cxx
+45
-1
45 additions, 1 deletion
GeoModelCore/GeoModelHelpers/src/GeoShapeUtils.cxx
GeoModelCore/GeoModelHelpers/src/MaterialManager.cxx
+8
-10
8 additions, 10 deletions
GeoModelCore/GeoModelHelpers/src/MaterialManager.cxx
with
53 additions
and
11 deletions
GeoModelCore/GeoModelHelpers/src/GeoShapeUtils.cxx
+
45
−
1
View file @
c8364ca3
...
@@ -28,6 +28,10 @@
...
@@ -28,6 +28,10 @@
#include
<vector>
#include
<vector>
namespace
{
constexpr
unsigned
tubeApproxEdges
=
8
;
}
std
::
pair
<
const
GeoShape
*
,
const
GeoShape
*>
getOps
(
const
GeoShape
*
composed
)
{
std
::
pair
<
const
GeoShape
*
,
const
GeoShape
*>
getOps
(
const
GeoShape
*
composed
)
{
if
(
composed
->
typeID
()
==
GeoShapeUnion
::
getClassTypeID
())
{
if
(
composed
->
typeID
()
==
GeoShapeUnion
::
getClassTypeID
())
{
const
GeoShapeUnion
*
unionShape
=
dynamic_cast
<
const
GeoShapeUnion
*>
(
composed
);
const
GeoShapeUnion
*
unionShape
=
dynamic_cast
<
const
GeoShapeUnion
*>
(
composed
);
...
@@ -48,7 +52,7 @@ std::pair<const GeoShape* , const GeoShape*> getOps(const GeoShape* composed) {
...
@@ -48,7 +52,7 @@ std::pair<const GeoShape* , const GeoShape*> getOps(const GeoShape* composed) {
unsigned
int
countComposedShapes
(
const
GeoShape
*
shape
)
{
unsigned
int
countComposedShapes
(
const
GeoShape
*
shape
)
{
std
::
pair
<
const
GeoShape
*
,
const
GeoShape
*>
ops
=
getOps
(
shape
);
std
::
pair
<
const
GeoShape
*
,
const
GeoShape
*>
ops
=
getOps
(
shape
);
return
1
+
(
ops
.
first
?
countComposedShapes
(
ops
.
first
)
:
0
)
+
return
1
+
(
ops
.
first
?
countComposedShapes
(
ops
.
first
)
:
0
)
+
(
ops
.
second
?
countComposedShapes
(
ops
.
second
)
:
0
);
(
ops
.
second
?
countComposedShapes
(
ops
.
second
)
:
0
);
}
}
GeoIntrusivePtr
<
const
GeoShape
>
compressShift
(
const
GeoShape
*
shift
)
{
GeoIntrusivePtr
<
const
GeoShape
>
compressShift
(
const
GeoShape
*
shift
)
{
...
@@ -229,6 +233,46 @@ std::vector<GeoTrf::Vector3D> getPolyShapeEdges(const GeoShape* shape,
...
@@ -229,6 +233,46 @@ std::vector<GeoTrf::Vector3D> getPolyShapeEdges(const GeoShape* shape,
}
}
}
}
}
else
if
(
shape
->
typeID
()
==
GeoTube
::
getClassTypeID
())
{
constexpr
double
stepLength
=
2.
*
M_PI
/
tubeApproxEdges
;
const
GeoTube
*
tube
=
static_cast
<
const
GeoTube
*>
(
shape
);
for
(
const
double
z
:
{
-
1.
,
1.
}){
for
(
unsigned
int
e
=
0
;
e
<
tubeApproxEdges
;
++
e
)
{
edgePoints
.
emplace_back
(
tube
->
getRMax
()
*
std
::
cos
(
stepLength
*
e
),
tube
->
getRMax
()
*
std
::
sin
(
stepLength
*
e
),
z
*
tube
->
getZHalfLength
());
}
}
}
else
if
(
shape
->
typeID
()
==
GeoTubs
::
getClassTypeID
())
{
const
GeoTubs
*
tubs
=
static_cast
<
const
GeoTubs
*>
(
shape
);
const
double
stepSize
=
tubs
->
getDPhi
()
/
tubeApproxEdges
;
for
(
const
double
z
:
{
-
1.
,
1.
})
{
for
(
unsigned
e
=
0
;
e
<=
tubeApproxEdges
;
++
e
)
{
edgePoints
.
emplace_back
(
tubs
->
getRMax
()
*
std
::
cos
(
tubs
->
getSPhi
()
+
stepSize
*
e
),
tubs
->
getRMax
()
*
std
::
sin
(
tubs
->
getSPhi
()
+
stepSize
*
e
),
z
*
tubs
->
getZHalfLength
());
}
}
}
else
if
(
shape
->
typeID
()
==
GeoEllipticalTube
::
getClassTypeID
())
{
const
GeoEllipticalTube
*
tube
=
static_cast
<
const
GeoEllipticalTube
*>
(
shape
);
constexpr
double
stepSize
=
2.
*
M_PI
/
tubeApproxEdges
;
for
(
const
double
z
:
{
-
1.
,
1.
})
{
for
(
unsigned
e
=
0
;
e
<
tubeApproxEdges
;
++
e
){
edgePoints
.
emplace_back
(
tube
->
getXHalfLength
()
*
std
::
cos
(
stepSize
*
e
),
tube
->
getYHalfLength
()
*
std
::
sin
(
stepSize
*
e
),
z
*
tube
->
getZHalfLength
());
}
}
}
else
if
(
shape
->
typeID
()
==
GeoTorus
::
getClassTypeID
())
{
constexpr
double
stepSize
=
2.
*
M_PI
/
tubeApproxEdges
;
const
GeoTorus
*
torus
=
static_cast
<
const
GeoTorus
*>
(
shape
);
for
(
unsigned
int
donut
=
0
;
donut
<
tubeApproxEdges
;
++
donut
)
{
for
(
unsigned
int
slice
=
0
;
slice
<
tubeApproxEdges
;
++
slice
)
{
edgePoints
.
emplace_back
((
torus
->
getRTor
()
+
torus
->
getRMax
()
*
std
::
cos
(
slice
*
stepSize
))
*
std
::
cos
(
donut
*
stepSize
),
(
torus
->
getRTor
()
+
torus
->
getRMax
()
*
std
::
cos
(
slice
*
stepSize
))
*
std
::
sin
(
donut
*
stepSize
),
torus
->
getRMax
()
*
std
::
sin
(
slice
*
stepSize
));
}
}
}
else
{
}
else
{
THROW_EXCEPTION
(
"The shape "
<<
shape
->
type
()
<<
" is not supported. Please add it to the list"
);
THROW_EXCEPTION
(
"The shape "
<<
shape
->
type
()
<<
" is not supported. Please add it to the list"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
GeoModelCore/GeoModelHelpers/src/MaterialManager.cxx
+
8
−
10
View file @
c8364ca3
...
@@ -33,15 +33,14 @@ namespace {
...
@@ -33,15 +33,14 @@ namespace {
const
GeoMaterial
*
MaterialManager
::
MaterialFactory
::
get
()
const
{
return
m_material
;
}
const
GeoMaterial
*
MaterialManager
::
MaterialFactory
::
get
()
const
{
return
m_material
;
}
MaterialManager
::
MaterialFactory
::~
MaterialFactory
()
{
MaterialManager
::
MaterialFactory
::~
MaterialFactory
()
{
if
(
!
m_material
)
return
;
if
(
!
m_material
)
return
;
// std::cout<<"MaterialFactory() -- finalize " <<m_material->getName()<<std::endl;
if
(
m_components
.
empty
())
{
if
(
m_components
.
empty
())
{
m_material
->
lock
();
m_material
->
lock
();
return
;
return
;
}
}
const
double
inv_totalFraction
=
1.
/
m_totFraction
;
const
double
inv_totalFraction
=
1.
/
m_totFraction
;
for
(
const
auto
&
[
element
,
fraction
]
:
m_components
)
{
for
(
const
auto
&
[
element
,
fraction
]
:
m_components
)
{
m_material
->
add
(
element
,
m_material
->
add
(
element
,
fraction
*
element
->
getA
()
*
inv_totalFraction
);
fraction
*
element
->
getA
()
*
inv_totalFraction
);
}
}
m_material
->
lock
();
m_material
->
lock
();
}
}
...
@@ -56,8 +55,7 @@ void MaterialManager::MaterialFactory::addComponent(const ConstMaterialPtr& mat,
...
@@ -56,8 +55,7 @@ void MaterialManager::MaterialFactory::addComponent(const ConstMaterialPtr& mat,
addComponent
(
elePtr
,
mat
->
getFraction
(
ele
)
*
fraction
);
addComponent
(
elePtr
,
mat
->
getFraction
(
ele
)
*
fraction
);
}
}
}
}
void
MaterialManager
::
MaterialFactory
::
addComponent
(
const
ConstElementPtr
&
ele
,
void
MaterialManager
::
MaterialFactory
::
addComponent
(
const
ConstElementPtr
&
ele
,
double
fraction
)
{
double
fraction
)
{
m_components
.
emplace_back
(
std
::
make_pair
(
ele
,
fraction
));
m_components
.
emplace_back
(
std
::
make_pair
(
ele
,
fraction
));
m_totFraction
+=
fraction
;
m_totFraction
+=
fraction
;
}
}
...
@@ -135,7 +133,7 @@ void MaterialManager::printAll() const {
...
@@ -135,7 +133,7 @@ void MaterialManager::printAll() const {
}
}
void
MaterialManager
::
addElement
(
const
std
::
string
&
name
,
const
std
::
string
&
symbol
,
double
z
,
double
a
)
{
void
MaterialManager
::
addElement
(
const
std
::
string
&
name
,
const
std
::
string
&
symbol
,
double
z
,
double
a
)
{
GeoIntrusivePtr
<
GeoElement
>
newElement
{
new
GeoElement
(
name
,
symbol
,
z
,
a
*
atomicDensity
)};
GeoIntrusivePtr
<
GeoElement
>
newElement
{
make_intrusive
<
GeoElement
>
(
name
,
symbol
,
z
,
a
*
atomicDensity
)};
addElement
(
newElement
);
addElement
(
newElement
);
}
}
...
@@ -158,7 +156,7 @@ void MaterialManager::setMaterialNamespace(const std::string &name) {
...
@@ -158,7 +156,7 @@ void MaterialManager::setMaterialNamespace(const std::string &name) {
void
MaterialManager
::
lockMaterial
()
{
m_factory
.
reset
();
}
void
MaterialManager
::
lockMaterial
()
{
m_factory
.
reset
();
}
void
MaterialManager
::
addMaterial
(
const
std
::
string
&
name
,
double
density
)
{
void
MaterialManager
::
addMaterial
(
const
std
::
string
&
name
,
double
density
)
{
MaterialPtr
newMat
{
new
GeoMaterial
(
name
,
density
*
volDensity
)};
MaterialPtr
newMat
{
make_intrusive
<
GeoMaterial
>
(
name
,
density
*
volDensity
)};
addMaterial
(
newMat
);
addMaterial
(
newMat
);
}
}
...
@@ -200,14 +198,14 @@ void MaterialManager::addMatComponent(const std::string &name, double fraction)
...
@@ -200,14 +198,14 @@ void MaterialManager::addMatComponent(const std::string &name, double fraction)
}
}
void
MaterialManager
::
buildSpecialMaterials
()
{
void
MaterialManager
::
buildSpecialMaterials
()
{
// Ether
// Ether
GeoIntrusivePtr
<
GeoElement
>
ethElement
{
new
GeoElement
(
"Ether"
,
"ET"
,
500.0
,
0.0
)};
GeoIntrusivePtr
<
GeoElement
>
ethElement
{
make_intrusive
<
GeoElement
>
(
"Ether"
,
"ET"
,
500.0
,
0.0
)};
m_elements
.
insert
(
std
::
make_pair
(
"Ether"
,
ethElement
));
m_elements
.
insert
(
std
::
make_pair
(
"Ether"
,
ethElement
));
GeoIntrusivePtr
<
GeoMaterial
>
ether
{
new
GeoMaterial
(
"special::Ether"
,
0.0
)};
GeoIntrusivePtr
<
GeoMaterial
>
ether
{
make_intrusive
<
GeoMaterial
>
(
"special::Ether"
,
0.0
)};
ether
->
add
(
ethElement
,
1.
);
ether
->
add
(
ethElement
,
1.
);
ether
->
lock
();
ether
->
lock
();
m_materials
.
insert
(
std
::
make_pair
(
"special::Ether"
,
ether
));
m_materials
.
insert
(
std
::
make_pair
(
"special::Ether"
,
ether
));
// HyperUranium
// HyperUranium
GeoIntrusivePtr
<
GeoMaterial
>
hu
{
new
GeoMaterial
(
"special::HyperUranium"
,
0.0
)};
GeoIntrusivePtr
<
GeoMaterial
>
hu
{
make_intrusive
<
GeoMaterial
>
(
"special::HyperUranium"
,
0.0
)};
hu
->
add
(
ethElement
,
1.
);
hu
->
add
(
ethElement
,
1.
);
hu
->
lock
();
hu
->
lock
();
m_materials
.
insert
(
std
::
make_pair
(
"special::HyperUranium"
,
hu
));
m_materials
.
insert
(
std
::
make_pair
(
"special::HyperUranium"
,
hu
));
...
...
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