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
42ea7309
Commit
42ea7309
authored
9 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
better computation of elements on one side of the crack
parent
b671bb6f
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
+30
-44
30 additions, 44 deletions
Plugin/Crack.cpp
with
30 additions
and
44 deletions
Plugin/Crack.cpp
+
30
−
44
View file @
42ea7309
...
@@ -169,64 +169,56 @@ PView *GMSH_CrackPlugin::execute(PView *view)
...
@@ -169,64 +169,56 @@ PView *GMSH_CrackPlugin::execute(PView *view)
}
}
}
}
}
}
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
);
// compute smoothed normals on crack vertices
std
::
map
<
MVertex
*
,
std
::
vector
<
MElement
*>
>
vxe
;
for
(
unsigned
int
i
=
0
;
i
<
crackElements
.
size
();
i
++
){
MElement
*
e
=
crackElements
[
i
];
for
(
int
k
=
0
;
k
<
e
->
getNumVertices
();
k
++
)
vxe
[
e
->
getVertex
(
k
)].
push_back
(
e
);
}
std
::
map
<
MVertex
*
,
SVector3
>
vxn
;
for
(
std
::
map
<
MVertex
*
,
std
::
vector
<
MElement
*>
>::
iterator
it
=
vxe
.
begin
();
it
!=
vxe
.
end
();
it
++
){
SVector3
n
;
for
(
unsigned
int
i
=
0
;
i
<
it
->
second
.
size
();
i
++
){
if
(
dim
==
1
)
n
+=
crossprod
(
normal1d
,
it
->
second
[
i
]
->
getEdge
(
0
).
tangent
());
else
n
+=
it
->
second
[
i
]
->
getFace
(
0
).
normal
();
}
n
.
normalize
();
vxn
[
it
->
first
]
=
n
;
}
// compute elements on one side of the crack
// compute elements on one side of the crack
vxe
.
clear
()
;
std
::
set
<
MElement
*>
oneside
;
std
::
vector
<
GEntity
*>
allentities
;
std
::
vector
<
GEntity
*>
allentities
;
m
->
getEntities
(
allentities
);
m
->
getEntities
(
allentities
);
for
(
unsigned
int
ent
=
0
;
ent
<
allentities
.
size
();
ent
++
){
for
(
unsigned
int
ent
=
0
;
ent
<
allentities
.
size
();
ent
++
){
//if(allentities[ent]->dim() != dim + 1) continue;
if
(
crackEntities
.
find
(
allentities
[
ent
])
!=
crackEntities
.
end
())
continue
;
if
(
crackEntities
.
find
(
allentities
[
ent
])
!=
crackEntities
.
end
())
continue
;
for
(
unsigned
int
i
=
0
;
i
<
allentities
[
ent
]
->
getNumMeshElements
();
i
++
){
for
(
unsigned
int
i
=
0
;
i
<
allentities
[
ent
]
->
getNumMeshElements
();
i
++
){
MElement
*
e
=
allentities
[
ent
]
->
getMeshElement
(
i
);
MElement
*
e
=
allentities
[
ent
]
->
getMeshElement
(
i
);
for
(
int
j
=
0
;
j
<
e
->
getNumVertices
();
j
++
){
for
(
int
j
=
0
;
j
<
e
->
getNumVertices
();
j
++
){
MVertex
*
v
=
e
->
getVertex
(
j
);
if
(
crackVertices
.
find
(
e
->
getVertex
(
j
))
!=
crackVertices
.
end
()){
if
(
crackVertices
.
find
(
v
)
!=
crackVertices
.
end
()){
// element touches the crack: find the closest crack element
MVertex
*
vclose
=
0
;
SPoint3
b
=
e
->
barycenter
();
double
d
=
1e22
;
double
d
=
1e200
;
SVector3
dv
;
MElement
*
ce
=
0
;
for
(
std
::
set
<
MVertex
*>::
iterator
it
=
crackVertices
.
begin
();
for
(
unsigned
int
k
=
0
;
k
<
crackElements
.
size
();
k
++
){
it
!=
crackVertices
.
end
();
it
++
){
double
d2
=
b
.
distance
(
crackElements
[
k
]
->
barycenter
());
MVertex
*
v
=
*
it
;
double
d2
=
v
->
point
().
distance
(
e
->
barycenter
());
if
(
d2
<
d
){
if
(
d2
<
d
){
d
=
d2
;
d
=
d2
;
vclose
=
v
;
ce
=
crackElements
[
k
];
dv
=
SVector3
(
e
->
barycenter
(),
vclose
->
point
());
}
}
}
}
if
(
dot
(
vxn
[
vclose
],
dv
)
<
0
)
SVector3
dv
=
SVector3
(
e
->
barycenter
(),
ce
->
barycenter
());
vxe
[
v
].
push_back
(
e
);
SVector3
n
;
if
(
dim
==
1
)
n
=
crossprod
(
normal1d
,
ce
->
getEdge
(
0
).
tangent
());
else
n
=
ce
->
getFace
(
0
).
normal
();
if
(
dot
(
n
,
dv
)
<
0
){
oneside
.
insert
(
e
);
}
}
}
}
}
}
}
}
}
/*
FILE *fp = fopen("debug.pos", "w");
if(fp){
fprintf(fp, "View \"Ele < 0\" {\n");
for(std::set<MElement*>::iterator it = oneside.begin(); it != oneside.end(); it++)
(*it)->writePOS(fp, false, true, false, false, false, false);
fprintf(fp, "};\n");
fclose(fp);
}
*/
// create new crack entity
// create new crack entity
GEdge
*
crackEdge
=
0
;
GEdge
*
crackEdge
=
0
;
GFace
*
crackFace
=
0
;
GFace
*
crackFace
=
0
;
...
@@ -271,13 +263,7 @@ PView *GMSH_CrackPlugin::execute(PView *view)
...
@@ -271,13 +263,7 @@ PView *GMSH_CrackPlugin::execute(PView *view)
}
}
// replace vertices in elements on one side of the crack
// replace vertices in elements on one side of the crack
std
::
set
<
MElement
*>
eles
;
for
(
std
::
set
<
MElement
*>::
iterator
it
=
oneside
.
begin
();
it
!=
oneside
.
end
();
it
++
){
for
(
std
::
map
<
MVertex
*
,
std
::
vector
<
MElement
*>
>::
iterator
it
=
vxe
.
begin
();
it
!=
vxe
.
end
();
it
++
){
for
(
unsigned
int
i
=
0
;
i
<
it
->
second
.
size
();
i
++
)
eles
.
insert
(
it
->
second
[
i
]);
}
for
(
std
::
set
<
MElement
*>::
iterator
it
=
eles
.
begin
();
it
!=
eles
.
end
();
it
++
){
MElement
*
e
=
*
it
;
MElement
*
e
=
*
it
;
for
(
int
i
=
0
;
i
<
e
->
getNumVertices
();
i
++
){
for
(
int
i
=
0
;
i
<
e
->
getNumVertices
();
i
++
){
if
(
vxv
.
count
(
e
->
getVertex
(
i
)))
if
(
vxv
.
count
(
e
->
getVertex
(
i
)))
...
...
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