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
ac9d14f3
Commit
ac9d14f3
authored
16 years ago
by
Jean-François Remacle
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
c744ea64
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
Geo/GEdgeCompound.cpp
+131
-0
131 additions, 0 deletions
Geo/GEdgeCompound.cpp
Geo/GEdgeCompound.h
+42
-0
42 additions, 0 deletions
Geo/GEdgeCompound.h
with
173 additions
and
0 deletions
Geo/GEdgeCompound.cpp
0 → 100644
+
131
−
0
View file @
ac9d14f3
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#include
"GmshConfig.h"
#include
"GEdgeCompound.h"
#include
"Numeric.h"
GEdgeCompound
::
GEdgeCompound
(
GModel
*
m
,
int
tag
,
std
::
vector
<
GEdge
*>
&
compound
)
:
GEdge
(
m
,
tag
,
0
,
0
),
_compound
(
compound
)
{
orderEdges
();
int
N
=
_compound
.
size
();
v0
=
_orientation
[
0
]
?
_compound
[
0
]
->
getBeginVertex
()
:
_compound
[
0
]
->
getEndVertex
();
v1
=
_orientation
[
N
-
1
]
?
_compound
[
N
-
1
]
->
getEndVertex
()
:
_compound
[
N
-
1
]
->
getBeginVertex
();
v0
->
addEdge
(
this
);
v1
->
addEdge
(
this
);
parametrize
();
}
void
GEdgeCompound
::
orderEdges
()
{
std
::
list
<
GEdge
*>
edges
;
std
::
vector
<
GEdge
*>
_c
;
for
(
int
i
=
0
;
i
<
_compound
.
size
();
i
++
)
edges
.
push_back
(
_compound
[
i
]);
_c
.
push_back
(
*
(
edges
.
begin
()));
edges
.
erase
(
edges
.
begin
());
_orientation
.
push_back
(
true
);
GVertex
*
first
=
_c
[
0
]
->
getBeginVertex
();
GVertex
*
last
=
_c
[
0
]
->
getEndVertex
();
while
(
first
!=
last
){
if
(
edges
.
empty
())
break
;
for
(
std
::
list
<
GEdge
*>::
iterator
it
=
edges
.
begin
()
;
it
!=
edges
.
end
()
;
++
it
){
GEdge
*
e
=
*
it
;
// printf("last %d edge %d %d\n",last->tag(),e->getBeginVertex()->tag(),
// e->getEndVertex()->tag());
if
(
e
->
getBeginVertex
()
==
last
){
_c
.
push_back
(
e
);
edges
.
erase
(
it
);
_orientation
.
push_back
(
true
);
last
=
e
->
getEndVertex
();
break
;
}
else
if
(
e
->
getEndVertex
()
==
last
){
_c
.
push_back
(
e
);
edges
.
erase
(
it
);
_orientation
.
push_back
(
false
);
last
=
e
->
getBeginVertex
();
break
;
}
}
}
_compound
=
_c
;
}
int
GEdgeCompound
::
minimumMeshSegments
()
const
{
int
N
=
0
;
for
(
int
i
=
0
;
i
<
_compound
.
size
();
i
++
)
N
+=
_compound
[
i
]
->
minimumMeshSegments
();
return
N
;
}
int
GEdgeCompound
::
minimumDrawSegments
()
const
{
int
N
=
0
;
for
(
int
i
=
0
;
i
<
_compound
.
size
();
i
++
)
N
+=
_compound
[
i
]
->
minimumDrawSegments
();
return
N
;
}
GEdgeCompound
::~
GEdgeCompound
()
{
}
Range
<
double
>
GEdgeCompound
::
parBounds
(
int
i
)
const
{
return
Range
<
double
>
(
0
,
_pars
[
_compound
.
size
()
-
1
]);
}
/*
+--------+-----------+----------- ... ----+
0 _par[1] _par[2] _par[N-1]
*/
void
GEdgeCompound
::
getLocalParameter
(
const
double
&
t
,
int
&
iEdge
,
double
&
tLoc
)
const
{
for
(
iEdge
=
0
;
iEdge
<
_compound
.
size
()
;
iEdge
++
){
// printf("iEdge %d par %g\n",iEdge,_pars[iEdge]);
if
(
t
<=
_pars
[
iEdge
]){
tLoc
=
_orientation
[
iEdge
]
?
t
-
_pars
[
iEdge
]
:
_pars
[
iEdge
+
1
]
-
t
;
return
;
}
}
}
void
GEdgeCompound
::
parametrize
()
{
for
(
int
i
=
0
;
i
<
_compound
.
size
();
i
++
){
Range
<
double
>
b
=
_compound
[
i
]
->
parBounds
(
0
);
if
(
!
i
)
_pars
.
push_back
(
b
.
high
()
-
b
.
low
());
else
_pars
.
push_back
(
_pars
[
i
-
1
]
+
(
b
.
high
()
-
b
.
low
()));
}
}
double
GEdgeCompound
::
curvature
(
double
par
)
const
{
double
tLoc
;
int
iEdge
;
getLocalParameter
(
par
,
iEdge
,
tLoc
);
return
_compound
[
iEdge
]
->
curvature
(
tLoc
);
}
GPoint
GEdgeCompound
::
point
(
double
par
)
const
{
double
tLoc
;
int
iEdge
;
getLocalParameter
(
par
,
iEdge
,
tLoc
);
// printf("compound %d par %g edge %d loc %g\n",tag(),par,iEdge,tLoc);
return
_compound
[
iEdge
]
->
point
(
tLoc
);
}
SVector3
GEdgeCompound
::
firstDer
(
double
par
)
const
{
double
tLoc
;
int
iEdge
;
getLocalParameter
(
par
,
iEdge
,
tLoc
);
return
_compound
[
iEdge
]
->
firstDer
(
tLoc
);
}
This diff is collapsed.
Click to expand it.
Geo/GEdgeCompound.h
0 → 100644
+
42
−
0
View file @
ac9d14f3
// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#ifndef _GEDGE_COMPOUND_H_
#define _GEDGE_COMPOUND_H_
#include
"GFace.h"
#include
"GEdge.h"
/*
A GEdgeCompound is a model edge that is the compound of model edges.
*/
class
GEdgeCompound
:
public
GEdge
{
protected:
std
::
vector
<
GEdge
*>
_compound
;
std
::
vector
<
bool
>
_orientation
;
std
::
vector
<
double
>
_pars
;
void
parametrize
()
;
void
orderEdges
()
;
void
getLocalParameter
(
const
double
&
t
,
int
&
iEdge
,
double
&
tLoc
)
const
;
public:
GEdgeCompound
(
GModel
*
m
,
int
tag
,
std
::
vector
<
GEdge
*>
&
compound
);
virtual
~
GEdgeCompound
();
Range
<
double
>
parBounds
(
int
i
)
const
;
virtual
GPoint
point
(
double
par
)
const
;
virtual
SVector3
firstDer
(
double
par
)
const
;
virtual
GEntity
::
GeomType
geomType
()
const
{
return
CompoundCurve
;
}
ModelType
getNativeType
()
const
{
return
GmshModel
;
}
void
*
getNativePtr
()
const
{
return
0
;
}
virtual
double
curvature
(
double
t
)
const
;
virtual
int
minimumMeshSegments
()
const
;
virtual
int
minimumDrawSegments
()
const
;
};
#endif
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