Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
code
pugs
Commits
bcfe4005
Commit
bcfe4005
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Rename ItemId to ItemTypeId
parent
06b44fdf
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!7
Feature/itemvalue
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/mesh/Connectivity.cpp
+5
-5
5 additions, 5 deletions
src/mesh/Connectivity.cpp
src/mesh/Connectivity.hpp
+3
-3
3 additions, 3 deletions
src/mesh/Connectivity.hpp
src/mesh/ItemType.hpp
+7
-7
7 additions, 7 deletions
src/mesh/ItemType.hpp
tests/test_ItemType.cpp
+12
-12
12 additions, 12 deletions
tests/test_ItemType.cpp
with
27 additions
and
27 deletions
src/mesh/Connectivity.cpp
+
5
−
5
View file @
bcfe4005
...
@@ -97,7 +97,7 @@ void Connectivity<3>::_computeCellFaceAndFaceNodeConnectivities()
...
@@ -97,7 +97,7 @@ void Connectivity<3>::_computeCellFaceAndFaceNodeConnectivities()
{
{
auto
&
cell_to_face_matrix
auto
&
cell_to_face_matrix
=
m_item_to_item_matrix
[
itemId
(
ItemType
::
cell
)][
itemId
(
ItemType
::
face
)];
=
m_item_to_item_matrix
[
item
T
Id
(
ItemType
::
cell
)][
item
T
Id
(
ItemType
::
face
)];
std
::
vector
<
std
::
vector
<
unsigned
int
>>
cell_to_face_vector
(
this
->
numberOfCells
());
std
::
vector
<
std
::
vector
<
unsigned
int
>>
cell_to_face_vector
(
this
->
numberOfCells
());
for
(
size_t
j
=
0
;
j
<
cell_to_face_vector
.
size
();
++
j
)
{
for
(
size_t
j
=
0
;
j
<
cell_to_face_vector
.
size
();
++
j
)
{
cell_to_face_vector
[
j
].
resize
(
cell_nb_faces
[
j
]);
cell_to_face_vector
[
j
].
resize
(
cell_nb_faces
[
j
]);
...
@@ -129,7 +129,7 @@ void Connectivity<3>::_computeCellFaceAndFaceNodeConnectivities()
...
@@ -129,7 +129,7 @@ void Connectivity<3>::_computeCellFaceAndFaceNodeConnectivities()
{
{
auto
&
face_to_node_matrix
auto
&
face_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
ItemType
::
face
)][
itemId
(
ItemType
::
node
)];
=
m_item_to_item_matrix
[
item
T
Id
(
ItemType
::
face
)][
item
T
Id
(
ItemType
::
node
)];
std
::
vector
<
std
::
vector
<
unsigned
int
>>
face_to_node_vector
(
face_cells_map
.
size
());
std
::
vector
<
std
::
vector
<
unsigned
int
>>
face_to_node_vector
(
face_cells_map
.
size
());
int
l
=
0
;
int
l
=
0
;
...
@@ -192,7 +192,7 @@ void Connectivity<2>::_computeCellFaceAndFaceNodeConnectivities()
...
@@ -192,7 +192,7 @@ void Connectivity<2>::_computeCellFaceAndFaceNodeConnectivities()
++
l
;
++
l
;
}
}
auto
&
face_to_node_matrix
auto
&
face_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
ItemType
::
face
)][
itemId
(
ItemType
::
node
)];
=
m_item_to_item_matrix
[
item
T
Id
(
ItemType
::
face
)][
item
T
Id
(
ItemType
::
node
)];
face_to_node_matrix
=
face_to_node_vector
;
face_to_node_matrix
=
face_to_node_vector
;
}
}
...
@@ -207,7 +207,7 @@ void Connectivity<2>::_computeCellFaceAndFaceNodeConnectivities()
...
@@ -207,7 +207,7 @@ void Connectivity<2>::_computeCellFaceAndFaceNodeConnectivities()
++
l
;
++
l
;
}
}
auto
&
face_to_cell_matrix
auto
&
face_to_cell_matrix
=
m_item_to_item_matrix
[
itemId
(
ItemType
::
face
)][
itemId
(
ItemType
::
cell
)];
=
m_item_to_item_matrix
[
item
T
Id
(
ItemType
::
face
)][
item
T
Id
(
ItemType
::
cell
)];
face_to_cell_matrix
=
face_to_cell_vector
;
face_to_cell_matrix
=
face_to_cell_vector
;
}
}
}
}
...
@@ -221,7 +221,7 @@ Connectivity(const std::vector<std::vector<unsigned int>>& cell_by_node_vector,
...
@@ -221,7 +221,7 @@ Connectivity(const std::vector<std::vector<unsigned int>>& cell_by_node_vector,
Assert
(
cell_by_node_vector
.
size
()
==
cell_type_vector
.
size
());
Assert
(
cell_by_node_vector
.
size
()
==
cell_type_vector
.
size
());
auto
&
cell_to_node_matrix
auto
&
cell_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
ItemType
::
cell
)][
itemId
(
ItemType
::
node
)];
=
m_item_to_item_matrix
[
item
T
Id
(
ItemType
::
cell
)][
item
T
Id
(
ItemType
::
node
)];
cell_to_node_matrix
=
cell_by_node_vector
;
cell_to_node_matrix
=
cell_by_node_vector
;
Assert
(
this
->
numberOfCells
()
>
0
);
Assert
(
this
->
numberOfCells
()
>
0
);
...
...
This diff is collapsed.
Click to expand it.
src/mesh/Connectivity.hpp
+
3
−
3
View file @
bcfe4005
...
@@ -228,7 +228,7 @@ class Connectivity final
...
@@ -228,7 +228,7 @@ class Connectivity final
:
public
IConnectivity
:
public
IConnectivity
{
{
private:
private:
constexpr
static
auto
&
itemId
=
ItemId
<
Dimension
>::
itemId
;
constexpr
static
auto
&
item
T
Id
=
Item
Type
Id
<
Dimension
>::
item
T
Id
;
public:
public:
static
constexpr
size_t
dimension
=
Dimension
;
static
constexpr
size_t
dimension
=
Dimension
;
...
@@ -289,7 +289,7 @@ class Connectivity final
...
@@ -289,7 +289,7 @@ class Connectivity final
const
ItemType
&
item_type_1
)
const
const
ItemType
&
item_type_1
)
const
{
{
const
ConnectivityMatrix
&
connectivity_matrix
const
ConnectivityMatrix
&
connectivity_matrix
=
m_item_to_item_matrix
[
itemId
(
item_type_0
)][
itemId
(
item_type_1
)];
=
m_item_to_item_matrix
[
item
T
Id
(
item_type_0
)][
item
T
Id
(
item_type_1
)];
return
connectivity_matrix
.
isBuilt
();
return
connectivity_matrix
.
isBuilt
();
}
}
...
@@ -298,7 +298,7 @@ class Connectivity final
...
@@ -298,7 +298,7 @@ class Connectivity final
const
ItemType
&
item_type_1
)
const
const
ItemType
&
item_type_1
)
const
{
{
const
ConnectivityMatrix
&
connectivity_matrix
const
ConnectivityMatrix
&
connectivity_matrix
=
m_item_to_item_matrix
[
itemId
(
item_type_0
)][
itemId
(
item_type_1
)];
=
m_item_to_item_matrix
[
item
T
Id
(
item_type_0
)][
item
T
Id
(
item_type_1
)];
if
(
not
connectivity_matrix
.
isBuilt
())
{
if
(
not
connectivity_matrix
.
isBuilt
())
{
const_cast
<
ConnectivityMatrix
&>
(
connectivity_matrix
)
const_cast
<
ConnectivityMatrix
&>
(
connectivity_matrix
)
=
m_connectivity_computer
=
m_connectivity_computer
...
...
This diff is collapsed.
Click to expand it.
src/mesh/ItemType.hpp
+
7
−
7
View file @
bcfe4005
...
@@ -39,12 +39,12 @@ std::string_view itemName(const ItemType& item_type)
...
@@ -39,12 +39,12 @@ std::string_view itemName(const ItemType& item_type)
}
}
template
<
size_t
Dimension
>
template
<
size_t
Dimension
>
struct
ItemId
{};
struct
Item
Type
Id
{};
template
<
>
template
<
>
struct
ItemId
<
1
>
struct
Item
Type
Id
<
1
>
{
{
inline
static
constexpr
size_t
itemId
(
const
ItemType
&
item_type
)
{
inline
static
constexpr
size_t
item
T
Id
(
const
ItemType
&
item_type
)
{
size_t
i
=
std
::
numeric_limits
<
size_t
>::
max
();
size_t
i
=
std
::
numeric_limits
<
size_t
>::
max
();
switch
(
item_type
)
{
switch
(
item_type
)
{
case
ItemType
::
cell
:
{
case
ItemType
::
cell
:
{
...
@@ -64,9 +64,9 @@ struct ItemId<1>
...
@@ -64,9 +64,9 @@ struct ItemId<1>
};
};
template
<
>
template
<
>
struct
ItemId
<
2
>
struct
Item
Type
Id
<
2
>
{
{
inline
static
constexpr
size_t
itemId
(
const
ItemType
&
item_type
)
{
inline
static
constexpr
size_t
item
T
Id
(
const
ItemType
&
item_type
)
{
size_t
i
=
std
::
numeric_limits
<
size_t
>::
max
();
size_t
i
=
std
::
numeric_limits
<
size_t
>::
max
();
switch
(
item_type
)
{
switch
(
item_type
)
{
case
ItemType
::
cell
:
{
case
ItemType
::
cell
:
{
...
@@ -89,9 +89,9 @@ struct ItemId<2>
...
@@ -89,9 +89,9 @@ struct ItemId<2>
};
};
template
<
>
template
<
>
struct
ItemId
<
3
>
struct
Item
Type
Id
<
3
>
{
{
inline
static
constexpr
size_t
itemId
(
const
ItemType
&
item_type
)
{
inline
static
constexpr
size_t
item
T
Id
(
const
ItemType
&
item_type
)
{
size_t
i
=
std
::
numeric_limits
<
size_t
>::
max
();
size_t
i
=
std
::
numeric_limits
<
size_t
>::
max
();
switch
(
item_type
)
{
switch
(
item_type
)
{
case
ItemType
::
cell
:
{
case
ItemType
::
cell
:
{
...
...
This diff is collapsed.
Click to expand it.
tests/test_ItemType.cpp
+
12
−
12
View file @
bcfe4005
...
@@ -26,23 +26,23 @@ TEST_CASE("ItemType", "[connectivity]") {
...
@@ -26,23 +26,23 @@ TEST_CASE("ItemType", "[connectivity]") {
}
}
SECTION
(
"checking for item ids in 1d"
)
{
SECTION
(
"checking for item ids in 1d"
)
{
REQUIRE
(
ItemId
<
1
>::
itemId
(
cell_type
)
==
0
);
REQUIRE
(
Item
Type
Id
<
1
>::
item
T
Id
(
cell_type
)
==
0
);
REQUIRE
(
ItemId
<
1
>::
itemId
(
edge_type
)
==
1
);
REQUIRE
(
Item
Type
Id
<
1
>::
item
T
Id
(
edge_type
)
==
1
);
REQUIRE
(
ItemId
<
1
>::
itemId
(
face_type
)
==
1
);
REQUIRE
(
Item
Type
Id
<
1
>::
item
T
Id
(
face_type
)
==
1
);
REQUIRE
(
ItemId
<
1
>::
itemId
(
node_type
)
==
1
);
REQUIRE
(
Item
Type
Id
<
1
>::
item
T
Id
(
node_type
)
==
1
);
}
}
SECTION
(
"checking for item ids in 2d"
)
{
SECTION
(
"checking for item ids in 2d"
)
{
REQUIRE
(
ItemId
<
2
>::
itemId
(
cell_type
)
==
0
);
REQUIRE
(
Item
Type
Id
<
2
>::
item
T
Id
(
cell_type
)
==
0
);
REQUIRE
(
ItemId
<
2
>::
itemId
(
edge_type
)
==
1
);
REQUIRE
(
Item
Type
Id
<
2
>::
item
T
Id
(
edge_type
)
==
1
);
REQUIRE
(
ItemId
<
2
>::
itemId
(
face_type
)
==
1
);
REQUIRE
(
Item
Type
Id
<
2
>::
item
T
Id
(
face_type
)
==
1
);
REQUIRE
(
ItemId
<
2
>::
itemId
(
node_type
)
==
2
);
REQUIRE
(
Item
Type
Id
<
2
>::
item
T
Id
(
node_type
)
==
2
);
}
}
SECTION
(
"checking for item ids in 3d"
)
{
SECTION
(
"checking for item ids in 3d"
)
{
REQUIRE
(
ItemId
<
3
>::
itemId
(
cell_type
)
==
0
);
REQUIRE
(
Item
Type
Id
<
3
>::
item
T
Id
(
cell_type
)
==
0
);
REQUIRE
(
ItemId
<
3
>::
itemId
(
edge_type
)
==
1
);
REQUIRE
(
Item
Type
Id
<
3
>::
item
T
Id
(
edge_type
)
==
1
);
REQUIRE
(
ItemId
<
3
>::
itemId
(
face_type
)
==
2
);
REQUIRE
(
Item
Type
Id
<
3
>::
item
T
Id
(
face_type
)
==
2
);
REQUIRE
(
ItemId
<
3
>::
itemId
(
node_type
)
==
3
);
REQUIRE
(
Item
Type
Id
<
3
>::
item
T
Id
(
node_type
)
==
3
);
}
}
}
}
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