Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
d8f925f8
Commit
d8f925f8
authored
12 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
provide mapping for non-uniform partitioning
parent
7e9208e3
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
Plugin/SimplePartition.cpp
+28
-2
28 additions, 2 deletions
Plugin/SimplePartition.cpp
Plugin/SimplePartition.h
+2
-0
2 additions, 0 deletions
Plugin/SimplePartition.h
with
30 additions
and
2 deletions
Plugin/SimplePartition.cpp
+
28
−
2
View file @
d8f925f8
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include
"MQuadrangle.h"
#include
"MQuadrangle.h"
#include
"MFace.h"
#include
"MFace.h"
#include
"MEdge.h"
#include
"MEdge.h"
#include
"mathEvaluator.h"
#if defined(HAVE_MESH)
#if defined(HAVE_MESH)
#include
"meshPartition.h"
#include
"meshPartition.h"
#endif
#endif
...
@@ -23,6 +24,10 @@ StringXNumber SimplePartitionOptions_Number[] = {
...
@@ -23,6 +24,10 @@ StringXNumber SimplePartitionOptions_Number[] = {
{
GMSH_FULLRC
,
"CreateBoundaries"
,
NULL
,
1.
},
{
GMSH_FULLRC
,
"CreateBoundaries"
,
NULL
,
1.
},
};
};
StringXString
SimplePartitionOptions_String
[]
=
{
{
GMSH_FULLRC
,
"Mapping"
,
NULL
,
"t"
}
};
extern
"C"
extern
"C"
{
{
GMSH_Plugin
*
GMSH_RegisterSimplePartitionPlugin
()
GMSH_Plugin
*
GMSH_RegisterSimplePartitionPlugin
()
...
@@ -49,11 +54,23 @@ StringXNumber *GMSH_SimplePartitionPlugin::getOption(int iopt)
...
@@ -49,11 +54,23 @@ StringXNumber *GMSH_SimplePartitionPlugin::getOption(int iopt)
return
&
SimplePartitionOptions_Number
[
iopt
];
return
&
SimplePartitionOptions_Number
[
iopt
];
}
}
int
GMSH_SimplePartitionPlugin
::
getNbOptionsStr
()
const
{
return
sizeof
(
SimplePartitionOptions_String
)
/
sizeof
(
StringXString
);
}
StringXString
*
GMSH_SimplePartitionPlugin
::
getOptionStr
(
int
iopt
)
{
return
&
SimplePartitionOptions_String
[
iopt
];
}
PView
*
GMSH_SimplePartitionPlugin
::
execute
(
PView
*
v
)
PView
*
GMSH_SimplePartitionPlugin
::
execute
(
PView
*
v
)
{
{
int
numSlices
=
(
int
)
SimplePartitionOptions_Number
[
0
].
def
;
int
numSlices
=
(
int
)
SimplePartitionOptions_Number
[
0
].
def
;
int
direction
=
(
int
)
SimplePartitionOptions_Number
[
1
].
def
;
int
direction
=
(
int
)
SimplePartitionOptions_Number
[
1
].
def
;
int
createBoundaries
=
(
int
)
SimplePartitionOptions_Number
[
2
].
def
;
int
createBoundaries
=
(
int
)
SimplePartitionOptions_Number
[
2
].
def
;
std
::
vector
<
std
::
string
>
expr
(
1
);
expr
[
0
]
=
SimplePartitionOptions_String
[
0
].
def
;
// partition the highest dimension elements in the current model (lower
// partition the highest dimension elements in the current model (lower
// dimension elements on boundaries cannot be tagged a priori: there are
// dimension elements on boundaries cannot be tagged a priori: there are
...
@@ -63,8 +80,17 @@ PView *GMSH_SimplePartitionPlugin::execute(PView *v)
...
@@ -63,8 +80,17 @@ PView *GMSH_SimplePartitionPlugin::execute(PView *v)
SBoundingBox3d
bbox
=
m
->
bounds
();
SBoundingBox3d
bbox
=
m
->
bounds
();
double
pmin
=
bbox
.
min
()[
direction
],
pmax
=
bbox
.
max
()[
direction
];
double
pmin
=
bbox
.
min
()[
direction
],
pmax
=
bbox
.
max
()[
direction
];
std
::
vector
<
double
>
pp
(
numSlices
+
1
);
std
::
vector
<
double
>
pp
(
numSlices
+
1
);
for
(
int
p
=
0
;
p
<=
numSlices
;
p
++
)
pp
[
p
]
=
pmin
+
p
*
(
pmax
-
pmin
)
/
numSlices
;
std
::
vector
<
std
::
string
>
variables
(
1
);
variables
[
0
]
=
"t"
;
mathEvaluator
f
(
expr
,
variables
);
if
(
expr
.
empty
())
return
v
;
std
::
vector
<
double
>
values
(
1
),
res
(
1
);
for
(
int
p
=
0
;
p
<=
numSlices
;
p
++
){
double
t
=
values
[
0
]
=
(
double
)
p
/
(
double
)
numSlices
;
if
(
f
.
eval
(
values
,
res
))
t
=
res
[
0
];
pp
[
p
]
=
pmin
+
t
*
(
pmax
-
pmin
);
}
int
dim
=
m
->
getDim
();
int
dim
=
m
->
getDim
();
std
::
vector
<
GEntity
*>
entities
;
std
::
vector
<
GEntity
*>
entities
;
m
->
getEntities
(
entities
);
m
->
getEntities
(
entities
);
...
...
This diff is collapsed.
Click to expand it.
Plugin/SimplePartition.h
+
2
−
0
View file @
d8f925f8
...
@@ -25,6 +25,8 @@ class GMSH_SimplePartitionPlugin : public GMSH_PostPlugin
...
@@ -25,6 +25,8 @@ class GMSH_SimplePartitionPlugin : public GMSH_PostPlugin
std
::
string
getHelp
()
const
;
std
::
string
getHelp
()
const
;
int
getNbOptions
()
const
;
int
getNbOptions
()
const
;
StringXNumber
*
getOption
(
int
iopt
);
StringXNumber
*
getOption
(
int
iopt
);
int
getNbOptionsStr
()
const
;
StringXString
*
getOptionStr
(
int
iopt
);
PView
*
execute
(
PView
*
);
PView
*
execute
(
PView
*
);
};
};
...
...
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