Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs-feliks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
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
Feliks Kiszkurno
ogs-feliks
Commits
9cd5d535
Commit
9cd5d535
authored
10 years ago
by
Norihiro Watanabe
Browse files
Options
Downloads
Patches
Plain Diff
add triangle version of structured meshing
parent
4c081c94
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/MeshGenerators/MeshGenerator.cpp
+54
-0
54 additions, 0 deletions
MeshLib/MeshGenerators/MeshGenerator.cpp
MeshLib/MeshGenerators/MeshGenerator.h
+28
-0
28 additions, 0 deletions
MeshLib/MeshGenerators/MeshGenerator.h
with
82 additions
and
0 deletions
MeshLib/MeshGenerators/MeshGenerator.cpp
+
54
−
0
View file @
9cd5d535
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include
"Elements/Line.h"
#include
"Elements/Line.h"
#include
"Elements/Quad.h"
#include
"Elements/Quad.h"
#include
"Elements/Hex.h"
#include
"Elements/Hex.h"
#include
"Elements/Tri.h"
#include
<vector>
#include
<vector>
...
@@ -174,4 +175,57 @@ Mesh* MeshGenerator::generateRegularHexMesh(const unsigned n_x_cells,
...
@@ -174,4 +175,57 @@ Mesh* MeshGenerator::generateRegularHexMesh(const unsigned n_x_cells,
return
new
Mesh
(
mesh_name
,
nodes
,
elements
);
return
new
Mesh
(
mesh_name
,
nodes
,
elements
);
}
}
Mesh
*
MeshGenerator
::
generateRegularTriMesh
(
const
double
length
,
const
std
::
size_t
subdivision
,
const
GeoLib
::
Point
&
origin
)
{
return
generateRegularTriMesh
(
subdivision
,
subdivision
,
length
/
subdivision
,
origin
);
}
Mesh
*
MeshGenerator
::
generateRegularTriMesh
(
const
unsigned
n_x_cells
,
const
unsigned
n_y_cells
,
const
double
cell_size
,
GeoLib
::
Point
const
&
origin
,
std
::
string
const
&
mesh_name
)
{
//nodes
const
unsigned
n_x_nodes
(
n_x_cells
+
1
);
const
unsigned
n_y_nodes
(
n_y_cells
+
1
);
std
::
vector
<
Node
*>
nodes
;
nodes
.
reserve
(
n_x_nodes
*
n_y_nodes
);
for
(
std
::
size_t
i
=
0
;
i
<
n_y_nodes
;
i
++
)
{
const
double
y_offset
(
origin
[
1
]
+
cell_size
*
i
);
for
(
std
::
size_t
j
=
0
;
j
<
n_x_nodes
;
j
++
)
nodes
.
push_back
(
new
Node
(
origin
[
0
]
+
cell_size
*
j
,
y_offset
,
origin
[
2
]));
}
//elements
std
::
vector
<
Element
*>
elements
;
elements
.
reserve
(
n_x_cells
*
n_y_cells
*
2
);
for
(
std
::
size_t
j
=
0
;
j
<
n_y_cells
;
j
++
)
{
const
std
::
size_t
offset_y1
=
j
*
n_x_nodes
;
const
std
::
size_t
offset_y2
=
(
j
+
1
)
*
n_x_nodes
;
for
(
std
::
size_t
k
=
0
;
k
<
n_x_cells
;
k
++
)
{
std
::
array
<
Node
*
,
3
>
element1_nodes
;
element1_nodes
[
0
]
=
nodes
[
offset_y1
+
k
];
element1_nodes
[
1
]
=
nodes
[
offset_y2
+
k
+
1
];
element1_nodes
[
2
]
=
nodes
[
offset_y2
+
k
];
elements
.
push_back
(
new
Tri
(
element1_nodes
));
std
::
array
<
Node
*
,
3
>
element2_nodes
;
element2_nodes
[
0
]
=
nodes
[
offset_y1
+
k
];
element2_nodes
[
1
]
=
nodes
[
offset_y1
+
k
+
1
];
element2_nodes
[
2
]
=
nodes
[
offset_y2
+
k
+
1
];
elements
.
push_back
(
new
Tri
(
element2_nodes
));
}
}
return
new
Mesh
(
mesh_name
,
nodes
,
elements
);
}
}
}
This diff is collapsed.
Click to expand it.
MeshLib/MeshGenerators/MeshGenerator.h
+
28
−
0
View file @
9cd5d535
...
@@ -103,6 +103,34 @@ Mesh* generateRegularHexMesh(const unsigned n_x_cells,
...
@@ -103,6 +103,34 @@ Mesh* generateRegularHexMesh(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"
);
/**
* Generate a regular 2D Triangle-Element mesh. The mesh is generated in the
* x-y-plane.
*
* \param length Mesh's dimensions in x- and y-directions.
* \param subdivision Number of subdivisions.
* \param origin Optional mesh's origin (the lower left corner) with GeoLib::ORIGIN default.
*/
Mesh
*
generateRegularTriMesh
(
const
double
length
,
const
std
::
size_t
subdivision
,
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
);
/**
* Generate a regular 2D Triangle-Element mesh. The mesh is generated in the
* x-y-plane.
*
* \param n_x_cells Number of cells in x-direction.
* \param n_y_cells Number of cells in y-direction.
* \param cell_size Edge length of Triangle elements
* \param origin Optional mesh's origin (the lower left corner) with GeoLib::ORIGIN default.
* \param mesh_name Name of the new mesh.
*/
Mesh
*
generateRegularTriMesh
(
const
unsigned
n_x_cells
,
const
unsigned
n_y_cells
,
const
double
cell_size
,
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
,
std
::
string
const
&
mesh_name
=
"mesh"
);
}
//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