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
27f78045
"Mesh/BackgroundMesh.cpp" did not exist on "7bbccfc4a32f7a7950187cacd477a254ab465731"
Commit
27f78045
authored
15 years ago
by
Matti Pellika
Browse files
Options
Downloads
Patches
Plain Diff
No commit message
No commit message
parent
f15af79d
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
Geo/Cell.cpp
+26
-37
26 additions, 37 deletions
Geo/Cell.cpp
Geo/Cell.h
+7
-7
7 additions, 7 deletions
Geo/Cell.h
Geo/CellComplex.cpp
+10
-12
10 additions, 12 deletions
Geo/CellComplex.cpp
with
43 additions
and
56 deletions
Geo/Cell.cpp
+
26
−
37
View file @
27f78045
...
...
@@ -36,8 +36,8 @@ Cell::Cell(MElement* image) :
{
_dim
=
image
->
getDim
();
_image
=
image
;
for
(
int
i
=
0
;
i
<
image
->
getNumVertices
();
i
++
)
_vs
.
push_back
(
image
->
getVertex
(
i
)
->
getNum
());
for
(
int
i
=
0
;
i
<
getNumVertices
();
i
++
)
_vs
.
push_back
(
getVertex
(
i
)
->
getNum
());
std
::
sort
(
_vs
.
begin
(),
_vs
.
end
());
}
...
...
@@ -167,65 +167,58 @@ void Cell::restoreCell(){
_immune
=
false
;
}
bool
Cell
::
addBoundaryCell
(
int
orientation
,
Cell
*
cell
,
void
Cell
::
addBoundaryCell
(
int
orientation
,
Cell
*
cell
,
bool
orig
,
bool
other
)
{
if
(
orig
)
_obd
.
insert
(
std
::
make_pair
(
cell
,
orientation
)
);
if
(
other
)
cell
->
addCoboundaryCell
(
orientation
,
this
);
biter
it
=
_bd
.
find
(
cell
);
if
(
it
!=
_bd
.
end
()){
(
*
it
).
second
=
(
*
it
).
second
+
orientation
;
if
((
*
it
).
second
==
0
)
{
int
newOrientation
=
(
*
it
).
second
+
orientation
;
if
(
newOrientation
!=
0
)
(
*
it
).
second
=
newOrientation
;
else
{
_bd
.
erase
(
it
);
(
*
it
).
first
->
removeCoboundaryCell
(
this
,
false
);
return
false
;
return
;
}
return
true
;
}
_bd
.
insert
(
std
::
make_pair
(
cell
,
orientation
)
);
return
true
;
else
_bd
.
insert
(
std
::
make_pair
(
cell
,
orientation
)
);
if
(
other
)
cell
->
addCoboundaryCell
(
orientation
,
this
,
orig
,
false
)
;
}
bool
Cell
::
addCoboundaryCell
(
int
orientation
,
Cell
*
cell
,
void
Cell
::
addCoboundaryCell
(
int
orientation
,
Cell
*
cell
,
bool
orig
,
bool
other
)
{
if
(
orig
)
_ocbd
.
insert
(
std
::
make_pair
(
cell
,
orientation
)
);
if
(
other
)
cell
->
addBoundaryCell
(
orientation
,
this
);
biter
it
=
_cbd
.
find
(
cell
);
if
(
it
!=
_cbd
.
end
()){
(
*
it
).
second
=
(
*
it
).
second
+
orientation
;
if
((
*
it
).
second
==
0
)
{
int
newOrientation
=
(
*
it
).
second
+
orientation
;
if
(
newOrientation
!=
0
)
(
*
it
).
second
=
newOrientation
;
else
{
_cbd
.
erase
(
it
);
(
*
it
).
first
->
removeBoundaryCell
(
this
,
false
);
return
false
;
return
;
}
return
true
;
}
_cbd
.
insert
(
std
::
make_pair
(
cell
,
orientation
)
);
return
true
;
else
_cbd
.
insert
(
std
::
make_pair
(
cell
,
orientation
)
);
if
(
other
)
cell
->
addBoundaryCell
(
orientation
,
this
,
orig
,
false
)
;
}
int
Cell
::
removeBoundaryCell
(
Cell
*
cell
,
bool
other
)
void
Cell
::
removeBoundaryCell
(
Cell
*
cell
,
bool
other
)
{
biter
it
=
_bd
.
find
(
cell
);
if
(
it
!=
_bd
.
end
()){
_bd
.
erase
(
it
);
if
(
other
)
(
*
it
).
first
->
removeCoboundaryCell
(
this
,
false
);
return
(
*
it
).
second
;
}
return
0
;
}
int
Cell
::
removeCoboundaryCell
(
Cell
*
cell
,
bool
other
)
void
Cell
::
removeCoboundaryCell
(
Cell
*
cell
,
bool
other
)
{
biter
it
=
_cbd
.
find
(
cell
);
if
(
it
!=
_cbd
.
end
()){
_cbd
.
erase
(
it
);
if
(
other
)
(
*
it
).
first
->
removeBoundaryCell
(
this
,
false
);
return
(
*
it
).
second
;
}
return
0
;
}
bool
Cell
::
hasBoundary
(
Cell
*
cell
,
bool
orig
)
...
...
@@ -329,7 +322,7 @@ CombinedCell::CombinedCell(Cell* c1, Cell* c2, bool orMatch, bool co) : Cell()
Cell
*
cell
=
(
*
it
).
first
;
int
ori
=
(
*
it
).
second
;
cell
->
removeCoboundaryCell
(
c1
);
if
(
this
->
addBoundaryCell
(
ori
,
cell
))
cell
->
addCoboundaryCell
(
ori
,
this
);
this
->
addBoundaryCell
(
ori
,
cell
,
false
,
true
);
}
for
(
biter
it
=
c2Boundary
.
begin
();
it
!=
c2Boundary
.
end
();
it
++
){
Cell
*
cell
=
(
*
it
).
first
;
...
...
@@ -338,13 +331,11 @@ CombinedCell::CombinedCell(Cell* c1, Cell* c2, bool orMatch, bool co) : Cell()
cell
->
removeCoboundaryCell
(
c2
);
if
(
co
){
biter
it2
=
c1Boundary
.
find
(
cell
);
if
(
it2
==
c1Boundary
.
end
()
&&
this
->
addBoundaryCell
(
ori
,
cell
))
{
cell
->
add
Cob
oundaryCell
(
ori
,
this
);
if
(
it2
==
c1Boundary
.
end
()
){
this
->
add
B
oundaryCell
(
ori
,
cell
,
false
,
true
);
}
}
else
{
if
(
this
->
addBoundaryCell
(
ori
,
cell
))
cell
->
addCoboundaryCell
(
ori
,
this
);
}
else
this
->
addBoundaryCell
(
ori
,
cell
,
false
,
true
);
}
// coboundary cells
...
...
@@ -357,7 +348,7 @@ CombinedCell::CombinedCell(Cell* c1, Cell* c2, bool orMatch, bool co) : Cell()
Cell
*
cell
=
(
*
it
).
first
;
int
ori
=
(
*
it
).
second
;
cell
->
removeBoundaryCell
(
c1
);
if
(
this
->
addCoboundaryCell
(
ori
,
cell
))
cell
->
addBoundaryCell
(
ori
,
this
);
this
->
addCoboundaryCell
(
ori
,
cell
,
false
,
true
);
}
for
(
biter
it
=
c2Coboundary
.
begin
();
it
!=
c2Coboundary
.
end
();
it
++
){
Cell
*
cell
=
(
*
it
).
first
;
...
...
@@ -366,13 +357,11 @@ CombinedCell::CombinedCell(Cell* c1, Cell* c2, bool orMatch, bool co) : Cell()
cell
->
removeBoundaryCell
(
c2
);
if
(
!
co
){
biter
it2
=
c1Coboundary
.
find
(
cell
);
if
(
it2
==
c1Coboundary
.
end
()
&&
this
->
addCoboundaryCell
(
ori
,
cell
)
){
cell
->
add
B
oundaryCell
(
ori
,
this
);
if
(
it2
==
c1Coboundary
.
end
()){
this
->
add
Cob
oundaryCell
(
ori
,
cell
,
false
,
true
);
}
}
else
{
if
(
this
->
addCoboundaryCell
(
ori
,
cell
))
cell
->
addBoundaryCell
(
ori
,
this
);
}
else
this
->
addCoboundaryCell
(
ori
,
cell
,
false
,
true
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Geo/Cell.h
+
7
−
7
View file @
27f78045
...
...
@@ -75,7 +75,7 @@ class Cell
// get the number of vertices this cell has
int
getNumVertices
()
const
{
if
(
_image
==
NULL
)
printf
(
"ERROR: No image mesh element for cell.
\n
"
);
return
_image
->
getNumVertices
();
}
return
_image
->
getNum
Primary
Vertices
();
}
// get the number of facets of this cell
int
getNumFacets
()
const
;
// get the vertices on a facet of this cell
...
...
@@ -143,14 +143,14 @@ class Cell
orig
?
coboundary
=
_ocbd
:
coboundary
=
_cbd
;
}
// add (co)boundary cell
virtual
bool
addBoundaryCell
(
int
orientation
,
Cell
*
cell
,
bool
orig
=
false
,
bool
other
=
fals
e
);
virtual
bool
addCoboundaryCell
(
int
orientation
,
Cell
*
cell
,
bool
orig
=
false
,
bool
other
=
fals
e
);
virtual
void
addBoundaryCell
(
int
orientation
,
Cell
*
cell
,
bool
orig
=
false
,
bool
other
=
tru
e
);
virtual
void
addCoboundaryCell
(
int
orientation
,
Cell
*
cell
,
bool
orig
=
false
,
bool
other
=
tru
e
);
// remove (co)boundary cell
virtual
int
removeBoundaryCell
(
Cell
*
cell
,
bool
other
=
true
);
virtual
int
removeCoboundaryCell
(
Cell
*
cell
,
bool
other
=
true
);
virtual
void
removeBoundaryCell
(
Cell
*
cell
,
bool
other
=
true
);
virtual
void
removeCoboundaryCell
(
Cell
*
cell
,
bool
other
=
true
);
// true if has given cell on (original) (co)boundary
virtual
bool
hasBoundary
(
Cell
*
cell
,
bool
orig
=
false
);
...
...
This diff is collapsed.
Click to expand it.
Geo/CellComplex.cpp
+
10
−
12
View file @
27f78045
...
...
@@ -81,8 +81,7 @@ bool CellComplex::insert_cells(std::vector<MElement*>& elements,
}
if
(
!
subdomain
)
{
int
ori
=
cell
->
getFacetOri
(
newCell
);
cell
->
addBoundaryCell
(
ori
,
newCell
,
true
);
newCell
->
addCoboundaryCell
(
ori
,
cell
,
true
);
cell
->
addBoundaryCell
(
ori
,
newCell
,
true
,
true
);
}
}
}
...
...
@@ -267,9 +266,6 @@ int CellComplex::reduceComplex(bool omit)
int
count
=
0
;
for
(
int
i
=
3
;
i
>
0
;
i
--
)
count
=
count
+
reduction
(
i
);
printf
(
" %d volumes, %d faces, %d edges and %d vertices.
\n
"
,
getSize
(
3
),
getSize
(
2
),
getSize
(
1
),
getSize
(
0
));
if
(
omit
){
int
omitted
=
0
;
_store
.
clear
();
...
...
@@ -290,12 +286,15 @@ int CellComplex::reduceComplex(bool omit)
}
}
printf
(
" %d volumes, %d faces, %d edges and %d vertices.
\n
"
,
getSize
(
3
),
getSize
(
2
),
getSize
(
1
),
getSize
(
0
));
combine
(
3
);
reduction
(
2
);
combine
(
2
);
reduction
(
1
);
combine
(
1
);
printf
(
" %d volumes, %d faces, %d edges and %d vertices.
\n
"
,
getSize
(
3
),
getSize
(
2
),
getSize
(
1
),
getSize
(
0
));
...
...
@@ -332,10 +331,6 @@ int CellComplex::coreduceComplex(bool omit)
}
}
printf
(
" %d volumes, %d faces, %d edges and %d vertices.
\n
"
,
getSize
(
3
),
getSize
(
2
),
getSize
(
1
),
getSize
(
0
));
int
omitted
=
0
;
if
(
omit
){
_store
.
clear
();
...
...
@@ -352,6 +347,9 @@ int CellComplex::coreduceComplex(bool omit)
coreduction
(
cell
,
omitted
);
}
}
printf
(
" %d volumes, %d faces, %d edges and %d vertices.
\n
"
,
getSize
(
3
),
getSize
(
2
),
getSize
(
1
),
getSize
(
0
));
cocombine
(
0
);
coreduction
(
1
);
...
...
@@ -508,7 +506,7 @@ bool CellComplex::coherent()
}
if
(
!
bdCell
->
hasCoboundary
(
cell
)){
printf
(
"Warning! Incoherent boundary/coboundary pair! Fixed.
\n
"
);
bdCell
->
addCoboundaryCell
(
ori
,
cell
);
bdCell
->
addCoboundaryCell
(
ori
,
cell
,
false
,
false
);
coherent
=
false
;
}
...
...
@@ -527,7 +525,7 @@ bool CellComplex::coherent()
}
if
(
!
cbdCell
->
hasBoundary
(
cell
)){
printf
(
"Warning! Incoherent coboundary/boundary pair! Fixed.
\n
"
);
cbdCell
->
addBoundaryCell
(
ori
,
cell
);
cbdCell
->
addBoundaryCell
(
ori
,
cell
,
false
,
false
);
coherent
=
false
;
}
...
...
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