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
abfa0a81
Commit
abfa0a81
authored
11 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
new options for open cracks
parent
cebd109c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Plugin/Crack.cpp
+33
-4
33 additions, 4 deletions
Plugin/Crack.cpp
with
33 additions
and
4 deletions
Plugin/Crack.cpp
+
33
−
4
View file @
abfa0a81
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
StringXNumber
CrackOptions_Number
[]
=
{
StringXNumber
CrackOptions_Number
[]
=
{
{
GMSH_FULLRC
,
"Dimension"
,
NULL
,
1.
},
{
GMSH_FULLRC
,
"Dimension"
,
NULL
,
1.
},
{
GMSH_FULLRC
,
"PhysicalGroup"
,
NULL
,
1.
},
{
GMSH_FULLRC
,
"PhysicalGroup"
,
NULL
,
1.
},
{
GMSH_FULLRC
,
"OpenBoundaryPhysicalGroup"
,
NULL
,
0.
},
};
};
extern
"C"
extern
"C"
...
@@ -33,9 +34,14 @@ std::string GMSH_CrackPlugin::getHelp() const
...
@@ -33,9 +34,14 @@ std::string GMSH_CrackPlugin::getHelp() const
"group `PhysicalGroup' of dimension `Dimension' (1 or 2). "
"group `PhysicalGroup' of dimension `Dimension' (1 or 2). "
"The plugin duplicates the vertices and the elements on "
"The plugin duplicates the vertices and the elements on "
"the crack and stores them in a new discrete curve "
"the crack and stores them in a new discrete curve "
"(Dimension = 1) or surface (Dimension = 2). The "
"(
`
Dimension
'
= 1) or surface (
`
Dimension
'
= 2). The "
"elements touching the crack on the negative side "
"elements touching the crack on the negative side "
"are modified to use the newly generated vertices."
;
"are modified to use the newly generated vertices."
"If `OpenBoundaryPhysicalGroup' is given (> 0), its "
"vertices are duplicated and the crack will be left "
"open on that (part of the) boundary. Otherwise, the "
"lips of the crack are sealed, i.e., its vertices are "
"not duplicated."
;
}
}
int
GMSH_CrackPlugin
::
getNbOptions
()
const
int
GMSH_CrackPlugin
::
getNbOptions
()
const
...
@@ -69,6 +75,7 @@ PView *GMSH_CrackPlugin::execute(PView *view)
...
@@ -69,6 +75,7 @@ PView *GMSH_CrackPlugin::execute(PView *view)
{
{
int
dim
=
(
int
)
CrackOptions_Number
[
0
].
def
;
int
dim
=
(
int
)
CrackOptions_Number
[
0
].
def
;
int
physical
=
(
int
)
CrackOptions_Number
[
1
].
def
;
int
physical
=
(
int
)
CrackOptions_Number
[
1
].
def
;
int
open
=
(
int
)
CrackOptions_Number
[
2
].
def
;
if
(
dim
!=
1
&&
dim
!=
2
){
if
(
dim
!=
1
&&
dim
!=
2
){
Msg
::
Error
(
"Crack dimension should be 1 or 2"
);
Msg
::
Error
(
"Crack dimension should be 1 or 2"
);
...
@@ -85,13 +92,23 @@ PView *GMSH_CrackPlugin::execute(PView *view)
...
@@ -85,13 +92,23 @@ PView *GMSH_CrackPlugin::execute(PView *view)
return
view
;
return
view
;
}
}
std
::
vector
<
GEntity
*>
openEntities
;
if
(
open
>
0
){
openEntities
=
groups
[
dim
-
1
][
open
];
if
(
openEntities
.
empty
()){
Msg
::
Error
(
"Open boundary physical group %d (dimension %d) is empty"
,
open
,
dim
-
1
);
return
view
;
}
}
// get crack elements
// get crack elements
std
::
vector
<
MElement
*>
crackElements
;
std
::
vector
<
MElement
*>
crackElements
;
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
)
for
(
unsigned
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
)
for
(
unsigned
int
j
=
0
;
j
<
entities
[
i
]
->
getNumMeshElements
();
j
++
)
crackElements
.
push_back
(
entities
[
i
]
->
getMeshElement
(
j
));
crackElements
.
push_back
(
entities
[
i
]
->
getMeshElement
(
j
));
// get internal crack vertices
// get internal crack vertices
and boundary vertices
std
::
set
<
MVertex
*>
crackVertices
,
bndVertices
;
std
::
set
<
MVertex
*>
crackVertices
,
bndVertices
;
if
(
dim
==
1
){
if
(
dim
==
1
){
for
(
unsigned
int
i
=
0
;
i
<
crackElements
.
size
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
crackElements
.
size
();
i
++
){
...
@@ -125,6 +142,18 @@ PView *GMSH_CrackPlugin::execute(PView *view)
...
@@ -125,6 +142,18 @@ PView *GMSH_CrackPlugin::execute(PView *view)
for
(
std
::
set
<
EdgeData
,
Less_EdgeData
>::
iterator
it
=
bnd
.
begin
();
it
!=
bnd
.
end
();
it
++
)
for
(
std
::
set
<
EdgeData
,
Less_EdgeData
>::
iterator
it
=
bnd
.
begin
();
it
!=
bnd
.
end
();
it
++
)
bndVertices
.
insert
(
it
->
data
.
begin
(),
it
->
data
.
end
());
bndVertices
.
insert
(
it
->
data
.
begin
(),
it
->
data
.
end
());
}
}
// get (forced) open boundary vertices and remove them from boundary vertices
for
(
unsigned
int
i
=
0
;
i
<
openEntities
.
size
();
i
++
){
for
(
unsigned
int
j
=
0
;
j
<
openEntities
[
i
]
->
getNumMeshElements
();
j
++
){
MElement
*
e
=
openEntities
[
i
]
->
getMeshElement
(
j
);
for
(
int
k
=
0
;
k
<
e
->
getNumVertices
();
k
++
){
MVertex
*
v
=
e
->
getVertex
(
k
);
bndVertices
.
erase
(
v
);
}
}
}
for
(
std
::
set
<
MVertex
*>::
iterator
it
=
bndVertices
.
begin
();
for
(
std
::
set
<
MVertex
*>::
iterator
it
=
bndVertices
.
begin
();
it
!=
bndVertices
.
end
();
it
++
)
it
!=
bndVertices
.
end
();
it
++
)
crackVertices
.
erase
(
*
it
);
crackVertices
.
erase
(
*
it
);
...
@@ -195,7 +224,7 @@ PView *GMSH_CrackPlugin::execute(PView *view)
...
@@ -195,7 +224,7 @@ PView *GMSH_CrackPlugin::execute(PView *view)
GEntity
*
crackEntity
=
crackEdge
?
(
GEntity
*
)
crackEdge
:
(
GEntity
*
)
crackFace
;
GEntity
*
crackEntity
=
crackEdge
?
(
GEntity
*
)
crackEdge
:
(
GEntity
*
)
crackFace
;
crackEntity
->
physicals
.
push_back
(
physical
);
crackEntity
->
physicals
.
push_back
(
physical
);
// duplicate crack vertices
// duplicate
internal
crack vertices
std
::
map
<
MVertex
*
,
MVertex
*>
vxv
;
std
::
map
<
MVertex
*
,
MVertex
*>
vxv
;
for
(
std
::
set
<
MVertex
*>::
iterator
it
=
crackVertices
.
begin
();
for
(
std
::
set
<
MVertex
*>::
iterator
it
=
crackVertices
.
begin
();
it
!=
crackVertices
.
end
();
it
++
){
it
!=
crackVertices
.
end
();
it
++
){
...
...
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