Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tools
frackit
Commits
61775850
Commit
61775850
authored
Jan 21, 2020
by
Dennis Gläser
Browse files
[entitynetwork] use id class
parent
bc92fe73
Changes
3
Hide whitespace changes
Inline
Side-by-side
frackit/entitynetwork/containedentitynetwork.hh
View file @
61775850
...
...
@@ -32,6 +32,7 @@
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <frackit/common/id.hh>
#include "containedentitynetworkinterface.hh"
namespace
Frackit
{
...
...
@@ -67,43 +68,43 @@ public:
,
subDomainEntityFragments_
(
std
::
move
(
entityFragments
))
,
subDomainEntityFragmentIndexMap_
(
std
::
move
(
entityFragmentMaps
))
{
subDomainI
ndice
s_
.
reserve
(
subDomainFragments_
.
size
());
subDomainI
d
s_
.
reserve
(
subDomainFragments_
.
size
());
for
(
const
auto
&
sdDataPair
:
subDomainFragments_
)
subDomainI
ndices_
.
push
_back
(
sdDataPair
.
first
);
subDomainI
ds_
.
emplace
_back
(
sdDataPair
.
first
);
}
/*!
* \brief Returns the i
ndice
s of defined the sub-domains
* \brief Returns the i
d
s of defined the sub-domains
*/
const
std
::
vector
<
std
::
size_t
>&
subDomainI
ndice
s
()
const
override
{
return
subDomainI
ndice
s_
;
}
const
std
::
vector
<
Id
>&
subDomainI
d
s
()
const
override
{
return
subDomainI
d
s_
;
}
/*!
* \brief Returns the fragments of a sub-domain
* \param subDomainIdx The index of the sub-domain
*/
const
TopTools_ListOfShape
&
subDomainFragments
(
std
::
size_t
subDomainId
x
)
const
override
{
return
subDomainFragments_
.
at
(
subDomainId
x
);
}
const
TopTools_ListOfShape
&
subDomainFragments
(
Id
subDomainId
)
const
override
{
return
subDomainFragments_
.
at
(
subDomainId
.
get
()
);
}
/*!
* \brief Returns the entity fragments of the network defined for a sub-domain
* \param subDomainIdx The index of the sub-domain
*/
const
TopTools_ListOfShape
&
subDomainEntityFragments
(
std
::
size_t
subDomainId
x
)
const
override
{
return
subDomainEntityFragments_
.
at
(
subDomainId
x
);
}
const
TopTools_ListOfShape
&
subDomainEntityFragments
(
Id
subDomainId
)
const
override
{
return
subDomainEntityFragments_
.
at
(
subDomainId
.
get
()
);
}
/*!
* \brief Returns the map which maps each fragment the network of a sub-domain to its primary entity index.
* \param subDomainIdx The index of the sub-domain
*/
const
TopTools_DataMapOfShapeInteger
&
subDomainEntityFragmentsIndexMap
(
std
::
size_t
subDomainId
x
)
const
override
{
return
subDomainEntityFragmentIndexMap_
.
at
(
subDomainId
x
);
}
const
TopTools_DataMapOfShapeInteger
&
subDomainEntityFragmentsIndexMap
(
Id
subDomainId
)
const
override
{
return
subDomainEntityFragmentIndexMap_
.
at
(
subDomainId
.
get
()
);
}
private:
std
::
unordered_map
<
std
::
size_t
,
TopTools_ListOfShape
>
subDomainFragments_
;
std
::
unordered_map
<
std
::
size_t
,
TopTools_ListOfShape
>
subDomainEntityFragments_
;
std
::
unordered_map
<
std
::
size_t
,
TopTools_DataMapOfShapeInteger
>
subDomainEntityFragmentIndexMap_
;
std
::
vector
<
std
::
size_t
>
subDomainI
ndice
s_
;
std
::
vector
<
Id
>
subDomainI
d
s_
;
};
}
// end namespace Frackit
...
...
frackit/entitynetwork/containedentitynetworkinterface.hh
View file @
61775850
...
...
@@ -30,6 +30,8 @@
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_Shape.hxx>
#include <frackit/common/id.hh>
namespace
Frackit
{
/*!
...
...
@@ -65,27 +67,27 @@ public:
{
return
domainDimension_
;
}
/*!
* \brief Returns the i
ndice
s of defined the sub-domains
* \brief Returns the i
d
s of defined the sub-domains
*/
virtual
const
std
::
vector
<
std
::
size_t
>&
subDomainI
ndice
s
()
const
=
0
;
virtual
const
std
::
vector
<
Id
>&
subDomainI
d
s
()
const
=
0
;
/*!
* \brief Returns the fragments of a sub-domain
* \param subDomainIdx The index of the sub-domain
*/
virtual
const
TopTools_ListOfShape
&
subDomainFragments
(
std
::
size_t
subDomainId
x
)
const
=
0
;
virtual
const
TopTools_ListOfShape
&
subDomainFragments
(
Id
subDomainId
)
const
=
0
;
/*!
* \brief Returns the entity fragments of the network defined for a sub-domain
* \param subDomainIdx The index of the sub-domain
*/
virtual
const
TopTools_ListOfShape
&
subDomainEntityFragments
(
std
::
size_t
subDomainId
x
)
const
=
0
;
virtual
const
TopTools_ListOfShape
&
subDomainEntityFragments
(
Id
subDomainId
)
const
=
0
;
/*!
* \brief Returns the map which maps each fragment the network of a sub-domain to its primary entity index.
* \param subDomainIdx The index of the sub-domain
*/
virtual
const
TopTools_DataMapOfShapeInteger
&
subDomainEntityFragmentsIndexMap
(
std
::
size_t
subDomainId
x
)
const
=
0
;
virtual
const
TopTools_DataMapOfShapeInteger
&
subDomainEntityFragmentsIndexMap
(
Id
subDomainId
)
const
=
0
;
private:
int
entityDimension_
;
...
...
frackit/io/brepwriter.hh
View file @
61775850
...
...
@@ -127,12 +127,12 @@ private:
void
makeEntityMap_
(
const
ContainedEntityNetwork
&
network
)
{
std
::
size_t
subNetworkOffset
=
0
;
for
(
auto
id
x
:
network
.
subDomainI
ndice
s
())
for
(
const
auto
&
id
:
network
.
subDomainI
d
s
())
{
// the map maps to the entity index within the sub-domain network
// Therefore, we add the offset in order to ensure that we don't add
// entities from another network to the same primary entity index
const
auto
&
map
=
network
.
subDomainEntityFragmentsIndexMap
(
id
x
);
const
auto
&
map
=
network
.
subDomainEntityFragmentsIndexMap
(
id
);
for
(
TopTools_DataMapIteratorOfDataMapOfShapeInteger
it
(
map
);
it
.
More
();
it
.
Next
())
{
allEntities_
.
Append
(
it
.
Key
());
...
...
@@ -198,16 +198,16 @@ private:
*/
void
makeSubShapeMaps_
(
const
ContainedEntityNetwork
&
network
)
{
for
(
auto
id
x
:
network
.
subDomainI
ndice
s
())
for
(
auto
id
:
network
.
subDomainI
d
s
())
{
const
auto
&
sdFragments
=
network
.
subDomainFragments
(
id
x
);
const
auto
&
sdFragments
=
network
.
subDomainFragments
(
id
);
for
(
TopTools_ListIteratorOfListOfShape
it
(
sdFragments
);
it
.
More
();
it
.
Next
())
addSolids_
(
it
.
Value
(),
id
x
);
addSolids_
(
it
.
Value
(),
id
.
get
()
);
}
for
(
auto
id
x
:
network
.
subDomainI
ndice
s
())
for
(
auto
id
:
network
.
subDomainI
d
s
())
{
const
auto
&
sdEntityFragments
=
network
.
subDomainEntityFragments
(
id
x
);
const
auto
&
sdEntityFragments
=
network
.
subDomainEntityFragments
(
id
);
for
(
TopTools_ListIteratorOfListOfShape
it
(
sdEntityFragments
);
it
.
More
();
it
.
Next
())
addFaces_
(
it
.
Value
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment