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
Iterations
Wiki
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
Service Desk
Analyze
Contributor 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
ogs
ogs
Commits
6d3e2734
Commit
6d3e2734
authored
9 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MeL] Construct surface meshes approximating a function.
parent
2fa3e4b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!783
Add another function for construction of a surface mesh approximating a function.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/MeshGenerators/MeshGenerator.cpp
+38
-0
38 additions, 0 deletions
MeshLib/MeshGenerators/MeshGenerator.cpp
MeshLib/MeshGenerators/MeshGenerator.h
+11
-0
11 additions, 0 deletions
MeshLib/MeshGenerators/MeshGenerator.h
with
49 additions
and
0 deletions
MeshLib/MeshGenerators/MeshGenerator.cpp
+
38
−
0
View file @
6d3e2734
...
@@ -364,4 +364,42 @@ Mesh* MeshGenerator::generateRegularTriMesh(
...
@@ -364,4 +364,42 @@ Mesh* MeshGenerator::generateRegularTriMesh(
return
new
Mesh
(
mesh_name
,
nodes
,
elements
);
return
new
Mesh
(
mesh_name
,
nodes
,
elements
);
}
}
MeshLib
::
Mesh
*
MeshGenerator
::
createSurfaceMesh
(
std
::
string
const
&
mesh_name
,
MathLib
::
Point3d
const
&
ll
,
MathLib
::
Point3d
const
&
ur
,
std
::
array
<
std
::
size_t
,
2
>
const
&
n_steps
,
std
::
function
<
double
(
double
,
double
)
>
f
)
{
std
::
array
<
double
,
2
>
step_size
{{
(
ur
[
0
]
-
ll
[
0
])
/
n_steps
[
0
],
(
ur
[
1
]
-
ll
[
1
])
/
n_steps
[
1
]}};
std
::
vector
<
MeshLib
::
Node
*>
nodes
;
for
(
std
::
size_t
j
(
0
);
j
<
n_steps
[
1
];
++
j
)
{
for
(
std
::
size_t
i
(
0
);
i
<
n_steps
[
0
];
++
i
)
{
std
::
size_t
const
id
(
i
+
j
*
n_steps
[
1
]);
std
::
array
<
double
,
3
>
coords
;
coords
[
0
]
=
ll
[
0
]
+
i
*
step_size
[
0
];
coords
[
1
]
=
ll
[
1
]
+
j
*
step_size
[
1
];
coords
[
2
]
=
f
(
coords
[
0
],
coords
[
1
]);
nodes
.
push_back
(
new
MeshLib
::
Node
(
coords
,
id
));
}
}
std
::
vector
<
MeshLib
::
Element
*>
sfc_eles
;
for
(
std
::
size_t
j
(
0
);
j
<
n_steps
[
1
]
-
1
;
++
j
)
{
for
(
std
::
size_t
i
(
0
);
i
<
n_steps
[
0
]
-
1
;
++
i
)
{
std
::
size_t
id_ll
(
i
+
j
*
n_steps
[
0
]);
std
::
size_t
id_lr
(
i
+
1
+
j
*
n_steps
[
0
]);
std
::
size_t
id_ul
(
i
+
(
j
+
1
)
*
n_steps
[
0
]);
std
::
size_t
id_ur
(
i
+
1
+
(
j
+
1
)
*
n_steps
[
0
]);
sfc_eles
.
push_back
(
new
MeshLib
::
Tri
(
std
::
array
<
MeshLib
::
Node
*
,
3
>
{{
nodes
[
id_ll
],
nodes
[
id_lr
],
nodes
[
id_ur
]}}));
sfc_eles
.
push_back
(
new
MeshLib
::
Tri
(
std
::
array
<
MeshLib
::
Node
*
,
3
>
{{
nodes
[
id_ll
],
nodes
[
id_ur
],
nodes
[
id_ul
]}}));
}
}
return
new
MeshLib
::
Mesh
(
mesh_name
,
nodes
,
sfc_eles
);
}
}
}
This diff is collapsed.
Click to expand it.
MeshLib/MeshGenerators/MeshGenerator.h
+
11
−
0
View file @
6d3e2734
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#define MESHGENERATOR_H_
#define MESHGENERATOR_H_
#include
<array>
#include
<array>
#include
<functional>
#include
<string>
#include
<string>
#include
<vector>
#include
<vector>
...
@@ -304,6 +305,16 @@ Mesh* generateRegularTriMesh(const unsigned n_x_cells,
...
@@ -304,6 +305,16 @@ Mesh* generateRegularTriMesh(const unsigned n_x_cells,
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
,
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
,
std
::
string
const
&
mesh_name
=
"mesh"
);
std
::
string
const
&
mesh_name
=
"mesh"
);
/// Constructs a surface mesh approximating a surface in the 3d space given by
/// a function.
/// The surface within the xy-domain \f$[ll[0], ur[0]] \times [ll[1], ur[1]\f$
/// is described using the function \f$f(x,y)\f$.
MeshLib
::
Mesh
*
createSurfaceMesh
(
std
::
string
const
&
mesh_name
,
MathLib
::
Point3d
const
&
ll
,
MathLib
::
Point3d
const
&
ur
,
std
::
array
<
std
::
size_t
,
2
>
const
&
n_steps
,
std
::
function
<
double
(
double
,
double
)
>
f
);
}
//MeshGenerator
}
//MeshGenerator
}
//MeshLib
}
//MeshLib
...
...
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