Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Özgür Ozan Sen
ogs
Commits
516ac0fc
Commit
516ac0fc
authored
10 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
Braces around array init lists. Whitespaces.
parent
47ce4705
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/MeshGenerators/LayeredVolume.cpp
+13
-13
13 additions, 13 deletions
MeshLib/MeshGenerators/LayeredVolume.cpp
MeshLib/MeshGenerators/MeshLayerMapper.cpp
+4
-4
4 additions, 4 deletions
MeshLib/MeshGenerators/MeshLayerMapper.cpp
with
17 additions
and
17 deletions
MeshLib/MeshGenerators/LayeredVolume.cpp
+
13
−
13
View file @
516ac0fc
...
...
@@ -42,7 +42,7 @@ bool LayeredVolume::createGeoVolumes(const MeshLib::Mesh &mesh, const std::vecto
{
if
(
mesh
.
getDimension
()
!=
2
||
!
allRastersExist
(
raster_paths
))
return
false
;
std
::
vector
<
GeoLib
::
Raster
const
*>
rasters
;
rasters
.
reserve
(
raster_paths
.
size
());
for
(
auto
path
=
raster_paths
.
begin
();
path
!=
raster_paths
.
end
();
++
path
)
...
...
@@ -69,7 +69,7 @@ bool LayeredVolume::createGeoVolumes(const MeshLib::Mesh &mesh, const std::vecto
MeshLib
::
Mesh
*
mesh_layer
(
ex
.
removeMeshElements
(
"MeshLayer"
));
if
(
mesh_layer
==
nullptr
)
mesh_layer
=
new
MeshLib
::
Mesh
(
mesh
);
// map each layer and attach to subsurface mesh
const
std
::
size_t
nRasters
(
rasters
.
size
());
for
(
size_t
i
=
0
;
i
<
nRasters
;
++
i
)
...
...
@@ -97,14 +97,14 @@ void LayeredVolume::addLayerToMesh(const MeshLib::Mesh &mesh_layer, unsigned lay
const
std
::
size_t
nNodes
(
layer_nodes
.
size
());
const
std
::
size_t
node_id_offset
(
_nodes
.
size
());
const
std
::
size_t
last_layer_offset
(
node_id_offset
-
nNodes
);
for
(
std
::
size_t
i
=
0
;
i
<
nNodes
;
++
i
)
{
if
(
layer_id
>
0
&&
((
*
layer_nodes
[
i
])[
2
]
==
_invalid_value
||
((
*
layer_nodes
[
i
])[
2
]
==
_invalid_value
||
(
*
_nodes
[
last_layer_offset
+
i
])[
2
]
-
(
*
layer_nodes
[
i
])[
2
]
<
_elevation_epsilon
))
_nodes
.
push_back
(
new
MeshLib
::
Node
(
*
_nodes
[
last_layer_offset
+
i
]));
else
else
_nodes
.
push_back
(
new
MeshLib
::
Node
(
layer_nodes
[
i
]
->
getCoords
(),
_nodes
.
size
()));
}
...
...
@@ -113,17 +113,17 @@ void LayeredVolume::addLayerToMesh(const MeshLib::Mesh &mesh_layer, unsigned lay
{
if
(
elem
->
getGeomType
()
==
MeshElemType
::
TRIANGLE
)
{
std
::
array
<
MeshLib
::
Node
*
,
3
>
tri_nodes
=
{
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
0
)],
std
::
array
<
MeshLib
::
Node
*
,
3
>
tri_nodes
=
{
{
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
0
)],
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
1
)],
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
2
)]
};
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
2
)]
}
};
_elements
.
push_back
(
new
MeshLib
::
Tri
(
tri_nodes
,
layer_id
+
1
));
}
else
if
(
elem
->
getGeomType
()
==
MeshElemType
::
QUAD
)
{
std
::
array
<
MeshLib
::
Node
*
,
4
>
quad_nodes
=
{
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
0
)],
{
std
::
array
<
MeshLib
::
Node
*
,
4
>
quad_nodes
=
{
{
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
0
)],
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
1
)],
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
2
)],
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
3
)]
};
_nodes
[
node_id_offset
+
elem
->
getNodeIndex
(
3
)]
}
};
_elements
.
push_back
(
new
MeshLib
::
Quad
(
quad_nodes
,
layer_id
+
1
));
}
}
...
...
@@ -146,15 +146,15 @@ void LayeredVolume::addLayerBoundaries(const MeshLib::Mesh &layer, std::size_t n
MeshLib
::
Node
*
n1
=
_nodes
[
offset
+
elem
->
getNodeIndex
((
i
+
1
)
%
nElemNodes
)];
MeshLib
::
Node
*
n2
=
_nodes
[
offset
+
nNodes
+
elem
->
getNodeIndex
((
i
+
1
)
%
nElemNodes
)];
MeshLib
::
Node
*
n3
=
_nodes
[
offset
+
nNodes
+
elem
->
getNodeIndex
(
i
)];
if
(
MathLib
::
Vector3
(
*
n1
,
*
n2
).
getLength
()
>
std
::
numeric_limits
<
double
>::
epsilon
())
{
const
std
::
array
<
MeshLib
::
Node
*
,
3
>
tri_nodes
=
{
n0
,
n2
,
n1
};
const
std
::
array
<
MeshLib
::
Node
*
,
3
>
tri_nodes
=
{
{
n0
,
n2
,
n1
}
};
_elements
.
push_back
(
new
MeshLib
::
Tri
(
tri_nodes
,
nLayers
+
1
+
j
));
}
if
(
MathLib
::
Vector3
(
*
n0
,
*
n3
).
getLength
()
>
std
::
numeric_limits
<
double
>::
epsilon
())
{
const
std
::
array
<
MeshLib
::
Node
*
,
3
>
tri_nodes
=
{
n0
,
n3
,
n2
};
const
std
::
array
<
MeshLib
::
Node
*
,
3
>
tri_nodes
=
{
{
n0
,
n3
,
n2
}
};
_elements
.
push_back
(
new
MeshLib
::
Tri
(
tri_nodes
,
nLayers
+
1
+
j
));
}
}
...
...
This diff is collapsed.
Click to expand it.
MeshLib/MeshGenerators/MeshLayerMapper.cpp
+
4
−
4
View file @
516ac0fc
...
...
@@ -168,16 +168,16 @@ bool MeshLayerMapper::LayerMapping(MeshLib::Mesh &new_mesh, const GeoLib::Raster
const
size_t
xIdx
(
static_cast
<
size_t
>
(
floor
(
xPos
)));
const
size_t
yIdx
(
static_cast
<
size_t
>
(
floor
(
yPos
)));
// weights for bilinear interpolation
// weights for bilinear interpolation
const
double
xShift
=
fabs
(
xPos
-
(
xIdx
+
half_delta
))
/
delta
;
const
double
yShift
=
fabs
(
yPos
-
(
yIdx
+
half_delta
))
/
delta
;
std
::
array
<
double
,
4
>
weight
=
{
(
1
-
xShift
)
*
(
1
-
xShift
),
xShift
*
(
1
-
yShift
),
xShift
*
yShift
,
(
1
-
xShift
)
*
yShift
};
std
::
array
<
double
,
4
>
weight
=
{
{
(
1
-
xShift
)
*
(
1
-
xShift
),
xShift
*
(
1
-
yShift
),
xShift
*
yShift
,
(
1
-
xShift
)
*
yShift
}
};
// neightbors to include in interpolation
const
int
xShiftIdx
=
(
xPos
-
xIdx
-
half_delta
>=
0
)
?
1
:
-
1
;
const
int
yShiftIdx
=
(
yPos
-
yIdx
-
half_delta
>=
0
)
?
1
:
-
1
;
const
std
::
array
<
int
,
4
>
x_nb
=
{
0
,
xShiftIdx
,
xShiftIdx
,
0
};
const
std
::
array
<
int
,
4
>
y_nb
=
{
0
,
0
,
yShiftIdx
,
yShiftIdx
};
const
std
::
array
<
int
,
4
>
x_nb
=
{
{
0
,
xShiftIdx
,
xShiftIdx
,
0
}
};
const
std
::
array
<
int
,
4
>
y_nb
=
{
{
0
,
0
,
yShiftIdx
,
yShiftIdx
}
};
// get pixel values
std
::
array
<
double
,
4
>
pix_val
;
...
...
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