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
b65ad8c1
Commit
b65ad8c1
authored
11 years ago
by
Karsten Rink
Browse files
Options
Downloads
Patches
Plain Diff
added possible signature and allowing for different number of rows and columns
parent
bb346cf3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Gui/mainwindow.cpp
+3
-0
3 additions, 0 deletions
Gui/mainwindow.cpp
MeshLib/MeshGenerators/MeshGenerator.cpp
+27
-21
27 additions, 21 deletions
MeshLib/MeshGenerators/MeshGenerator.cpp
MeshLib/MeshGenerators/MeshGenerator.h
+35
-1
35 additions, 1 deletion
MeshLib/MeshGenerators/MeshGenerator.h
with
65 additions
and
22 deletions
Gui/mainwindow.cpp
+
3
−
0
View file @
b65ad8c1
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
* http://www.opengeosys.org/project/license
* http://www.opengeosys.org/project/license
*
*
*/
*/
#include
"MeshGenerators\MeshGenerator.h"
#include
"Configure.h"
#include
"Configure.h"
#include
"mainwindow.h"
#include
"mainwindow.h"
...
@@ -1284,6 +1285,8 @@ void MainWindow::showDataExplorerSettingsDialog()
...
@@ -1284,6 +1285,8 @@ void MainWindow::showDataExplorerSettingsDialog()
void
MainWindow
::
FEMTestStart
()
void
MainWindow
::
FEMTestStart
()
{
{
_meshModels
->
addMesh
(
MeshLib
::
MeshGenerator
::
generateRegularQuadMesh
(
10
,
10
)
);
}
}
...
...
This diff is collapsed.
Click to expand it.
MeshLib/MeshGenerators/MeshGenerator.cpp
+
27
−
21
View file @
b65ad8c1
...
@@ -55,43 +55,49 @@ Mesh* MeshGenerator::generateRegularQuadMesh(
...
@@ -55,43 +55,49 @@ Mesh* MeshGenerator::generateRegularQuadMesh(
const
std
::
size_t
subdivision
,
const
std
::
size_t
subdivision
,
const
GeoLib
::
Point
&
origin
)
const
GeoLib
::
Point
&
origin
)
{
{
const
double
dx
=
length
/
subdivision
;
return
generateRegularQuadMesh
(
subdivision
,
subdivision
,
length
/
subdivision
,
origin
);
}
Mesh
*
MeshGenerator
::
generateRegularQuadMesh
(
const
unsigned
n_x_cells
,
const
unsigned
n_y_cells
,
const
double
cell_size
,
GeoLib
::
Point
const
&
origin
,
std
::
string
const
&
mesh_name
)
{
//nodes
//nodes
const
std
::
size_t
n_nodes
=
subdivision
+
1
;
const
unsigned
n_x_nodes
(
n_x_cells
+
1
);
std
::
vector
<
Node
*>
nodes
(
n_nodes
*
n_nodes
);
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
,
node_id
=
0
;
i
<
n_nodes
;
i
++
)
for
(
std
::
size_t
i
=
0
,
node_id
=
0
;
i
<
n_y_nodes
;
i
++
)
for
(
std
::
size_t
j
=
0
;
j
<
n_nodes
;
j
++
)
{
{
const
double
x_offset
(
origin
[
0
]
+
cell_size
*
i
);
nodes
[
node_id
]
=
new
Node
(
origin
[
0
]
+
dx
*
j
,
for
(
std
::
size_t
j
=
0
;
j
<
n_x_nodes
;
j
++
)
origin
[
1
]
+
dx
*
i
,
nodes
.
push_back
(
new
Node
(
origin
[
1
]
+
cell_size
*
j
,
x_offset
,
origin
[
2
]));
origin
[
2
],
}
node_id
);
node_id
++
;
}
//elements
//elements
std
::
size_t
const
n_eles
=
subdivision
;
std
::
vector
<
Element
*>
elements
;
std
::
vector
<
Element
*>
elements
(
n_eles
*
n_eles
);
elements
.
reserve
(
n_x_cells
*
n_y_cells
);
std
::
size_t
elem_id
=
0
;
for
(
std
::
size_t
j
=
0
;
j
<
subdivision
;
j
++
)
for
(
std
::
size_t
j
=
0
;
j
<
n_y_cells
;
j
++
)
{
{
const
std
::
size_t
offset_y1
=
j
*
n_nodes
;
const
std
::
size_t
offset_y1
=
j
*
n_
x_
nodes
;
const
std
::
size_t
offset_y2
=
(
j
+
1
)
*
n_nodes
;
const
std
::
size_t
offset_y2
=
(
j
+
1
)
*
n_
x_
nodes
;
for
(
std
::
size_t
k
=
0
;
k
<
subdivision
;
k
++
)
for
(
std
::
size_t
k
=
0
;
k
<
n_x_cells
;
k
++
)
{
{
std
::
array
<
Node
*
,
4
>
element_nodes
;
std
::
array
<
Node
*
,
4
>
element_nodes
;
element_nodes
[
0
]
=
nodes
[
offset_y1
+
k
];
element_nodes
[
0
]
=
nodes
[
offset_y1
+
k
];
element_nodes
[
1
]
=
nodes
[
offset_y1
+
k
+
1
];
element_nodes
[
1
]
=
nodes
[
offset_y1
+
k
+
1
];
element_nodes
[
2
]
=
nodes
[
offset_y2
+
k
+
1
];
element_nodes
[
2
]
=
nodes
[
offset_y2
+
k
+
1
];
element_nodes
[
3
]
=
nodes
[
offset_y2
+
k
];
element_nodes
[
3
]
=
nodes
[
offset_y2
+
k
];
elements
[
elem_id
++
]
=
new
Quad
(
element_nodes
);
elements
.
push_back
(
new
Quad
(
element_nodes
)
)
;
}
}
}
}
return
new
Mesh
(
"
mesh
"
,
nodes
,
elements
);
return
new
Mesh
(
mesh
_name
,
nodes
,
elements
);
}
}
Mesh
*
MeshGenerator
::
generateRegularHexMesh
(
Mesh
*
MeshGenerator
::
generateRegularHexMesh
(
...
...
This diff is collapsed.
Click to expand it.
MeshLib/MeshGenerators/MeshGenerator.h
+
35
−
1
View file @
b65ad8c1
...
@@ -14,6 +14,8 @@
...
@@ -14,6 +14,8 @@
#ifndef MESHGENERATOR_H_
#ifndef MESHGENERATOR_H_
#define MESHGENERATOR_H_
#define MESHGENERATOR_H_
#include
<string>
#include
"GeoLib/Point.h"
#include
"GeoLib/Point.h"
#include
"MeshLib/Mesh.h"
#include
"MeshLib/Mesh.h"
...
@@ -26,7 +28,7 @@ namespace MeshGenerator
...
@@ -26,7 +28,7 @@ namespace MeshGenerator
*
*
* \param length Mesh's length in x-direction.
* \param length Mesh's length in x-direction.
* \param subdivision Number of subdivisions.
* \param subdivision Number of subdivisions.
* \param origin Optional mesh's origin (the
most lef
t point) with GeoLib::ORIGIN default.
* \param origin Optional mesh's origin (the
left-mos
t point) with GeoLib::ORIGIN default.
*/
*/
Mesh
*
generateLineMesh
(
const
double
length
,
Mesh
*
generateLineMesh
(
const
double
length
,
const
std
::
size_t
subdivision
,
const
std
::
size_t
subdivision
,
...
@@ -44,6 +46,21 @@ Mesh* generateRegularQuadMesh(const double length,
...
@@ -44,6 +46,21 @@ Mesh* generateRegularQuadMesh(const double length,
const
std
::
size_t
subdivision
,
const
std
::
size_t
subdivision
,
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
);
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
);
/**
* Generate a regular 2D Quad-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 Quad elements
* \param origin Optional mesh's origin (the lower left corner) with GeoLib::ORIGIN default.
*/
Mesh
*
generateRegularQuadMesh
(
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"
);
/**
/**
* Generate a regular 3D Hex-Element mesh.
* Generate a regular 3D Hex-Element mesh.
*
*
...
@@ -54,6 +71,23 @@ Mesh* generateRegularQuadMesh(const double length,
...
@@ -54,6 +71,23 @@ Mesh* generateRegularQuadMesh(const double length,
Mesh
*
generateRegularHexMesh
(
const
double
length
,
Mesh
*
generateRegularHexMesh
(
const
double
length
,
const
std
::
size_t
subdivision
,
const
std
::
size_t
subdivision
,
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
);
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
);
/**
* Generate a regular 3D Hex-Element mesh.
*
* \param n_x_cells Number of cells in x-direction.
* \param n_y_cells Number of cells in y-direction.
* \param n_z_cells Number of cells in z-direction.
* \param cell_size Edge length of Hex elements
* \param origin Optional mesh's origin (the lower left corner) with GeoLib::ORIGIN default.
*/
Mesh
*
generateRegularQuadMesh
(
const
unsigned
n_x_cells
,
const
unsigned
n_y_cells
,
const
unsigned
n_z_cells
,
const
double
cell_size
,
GeoLib
::
Point
const
&
origin
=
GeoLib
::
ORIGIN
);
}
//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