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
bf413a02
Commit
bf413a02
authored
20 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
add callbacks to draw grid
parent
c715a4c9
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/CutGrid.cpp
+142
-17
142 additions, 17 deletions
Plugin/CutGrid.cpp
Plugin/CutGrid.h
+19
-3
19 additions, 3 deletions
Plugin/CutGrid.h
with
161 additions
and
20 deletions
Plugin/CutGrid.cpp
+
142
−
17
View file @
bf413a02
// $Id: CutGrid.cpp,v 1.
9
2004-1
1
-2
5
0
2:10:40
geuzaine Exp $
// $Id: CutGrid.cpp,v 1.
10
2004-1
2
-2
7
0
8:59:29
geuzaine Exp $
//
//
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
// Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle
//
//
...
@@ -23,23 +23,26 @@
...
@@ -23,23 +23,26 @@
#include
"CutGrid.h"
#include
"CutGrid.h"
#include
"List.h"
#include
"List.h"
#include
"Context.h"
#include
"Context.h"
#include
"Views.h"
#include
"Message.h"
#if defined(HAVE_FLTK)
#include
"GmshUI.h"
#include
"Draw.h"
#endif
extern
Context_T
CTX
;
extern
Context_T
CTX
;
StringXNumber
CutGridOptions_Number
[]
=
{
StringXNumber
CutGridOptions_Number
[]
=
{
{
GMSH_FULLRC
,
"X0"
,
NULL
,
-
1.
},
{
GMSH_FULLRC
,
"X0"
,
GMSH_CutGridPlugin
::
callbackX0
,
-
1.
},
{
GMSH_FULLRC
,
"Y0"
,
NULL
,
-
1.
},
{
GMSH_FULLRC
,
"Y0"
,
GMSH_CutGridPlugin
::
callbackY0
,
-
1.
},
{
GMSH_FULLRC
,
"Z0"
,
NULL
,
0.
},
{
GMSH_FULLRC
,
"Z0"
,
GMSH_CutGridPlugin
::
callbackZ0
,
0.
},
{
GMSH_FULLRC
,
"X1"
,
NULL
,
-
1.
},
{
GMSH_FULLRC
,
"X1"
,
GMSH_CutGridPlugin
::
callbackX1
,
-
1.
},
{
GMSH_FULLRC
,
"Y1"
,
NULL
,
0.
},
{
GMSH_FULLRC
,
"Y1"
,
GMSH_CutGridPlugin
::
callbackY1
,
0.
},
{
GMSH_FULLRC
,
"Z1"
,
NULL
,
0.
},
{
GMSH_FULLRC
,
"Z1"
,
GMSH_CutGridPlugin
::
callbackZ1
,
0.
},
{
GMSH_FULLRC
,
"X2"
,
NULL
,
0.
},
{
GMSH_FULLRC
,
"X2"
,
GMSH_CutGridPlugin
::
callbackX2
,
0.
},
{
GMSH_FULLRC
,
"Y2"
,
NULL
,
-
1.
},
{
GMSH_FULLRC
,
"Y2"
,
GMSH_CutGridPlugin
::
callbackY2
,
-
1.
},
{
GMSH_FULLRC
,
"Z2"
,
NULL
,
0.
},
{
GMSH_FULLRC
,
"Z2"
,
GMSH_CutGridPlugin
::
callbackZ2
,
0.
},
{
GMSH_FULLRC
,
"nPointsU"
,
NULL
,
20
},
{
GMSH_FULLRC
,
"nPointsU"
,
GMSH_CutGridPlugin
::
callbackU
,
20
},
{
GMSH_FULLRC
,
"nPointsV"
,
NULL
,
20
},
{
GMSH_FULLRC
,
"nPointsV"
,
GMSH_CutGridPlugin
::
callbackV
,
20
},
{
GMSH_FULLRC
,
"iView"
,
NULL
,
-
1.
}
{
GMSH_FULLRC
,
"iView"
,
NULL
,
-
1.
}
};
};
...
@@ -56,6 +59,128 @@ GMSH_CutGridPlugin::GMSH_CutGridPlugin()
...
@@ -56,6 +59,128 @@ GMSH_CutGridPlugin::GMSH_CutGridPlugin()
;
;
}
}
void
GMSH_CutGridPlugin
::
draw
()
{
#if defined(HAVE_FLTK)
glColor4ubv
((
GLubyte
*
)
&
CTX
.
color
.
fg
);
double
p
[
3
];
glBegin
(
GL_LINES
);
for
(
int
i
=
0
;
i
<
getNbU
();
++
i
){
getPoint
(
i
,
0
,
p
);
glVertex3d
(
p
[
0
],
p
[
1
],
p
[
2
]);
getPoint
(
i
,
getNbV
()
-
1
,
p
);
glVertex3d
(
p
[
0
],
p
[
1
],
p
[
2
]);
}
for
(
int
i
=
0
;
i
<
getNbV
();
++
i
){
getPoint
(
0
,
i
,
p
);
glVertex3d
(
p
[
0
],
p
[
1
],
p
[
2
]);
getPoint
(
getNbU
()
-
1
,
i
,
p
);
glVertex3d
(
p
[
0
],
p
[
1
],
p
[
2
]);
}
glEnd
();
#endif
}
void
GMSH_CutGridPlugin
::
callback
()
{
#if defined(HAVE_FLTK)
CTX
.
post
.
plugin_draw_function
=
draw
;
if
(
CTX
.
fast_redraw
){
CTX
.
post
.
draw
=
0
;
CTX
.
mesh
.
draw
=
0
;
}
if
(
!
CTX
.
batch
)
Draw
();
CTX
.
post
.
plugin_draw_function
=
NULL
;
CTX
.
post
.
draw
=
1
;
CTX
.
mesh
.
draw
=
1
;
#endif
}
double
GMSH_CutGridPlugin
::
callbackXYZ
(
int
num
,
int
action
,
double
value
,
double
*
opt
)
{
switch
(
action
){
// configure the input field
case
1
:
return
CTX
.
lc
/
200.
;
case
2
:
return
-
CTX
.
lc
;
case
3
:
return
CTX
.
lc
;
default:
break
;
}
*
opt
=
value
;
callback
();
return
0.
;
}
double
GMSH_CutGridPlugin
::
callbackX0
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
0
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackY0
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
1
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackZ0
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
2
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackX1
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
3
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackY1
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
4
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackZ1
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
5
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackX2
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
6
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackY2
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
7
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackZ2
(
int
num
,
int
action
,
double
value
)
{
return
callbackXYZ
(
num
,
action
,
value
,
&
CutGridOptions_Number
[
8
].
def
);
}
double
GMSH_CutGridPlugin
::
callbackU
(
int
num
,
int
action
,
double
value
)
{
switch
(
action
){
// configure the input field
case
1
:
return
1
;
case
2
:
return
2
;
case
3
:
return
100
;
default:
break
;
}
CutGridOptions_Number
[
9
].
def
=
value
;
callback
();
return
0.
;
}
double
GMSH_CutGridPlugin
::
callbackV
(
int
num
,
int
action
,
double
value
)
{
switch
(
action
){
// configure the input field
case
1
:
return
1
;
case
2
:
return
2
;
case
3
:
return
100
;
default:
break
;
}
CutGridOptions_Number
[
10
].
def
=
value
;
callback
();
return
0.
;
}
void
GMSH_CutGridPlugin
::
getName
(
char
*
name
)
const
void
GMSH_CutGridPlugin
::
getName
(
char
*
name
)
const
{
{
strcpy
(
name
,
"Cut grid"
);
strcpy
(
name
,
"Cut grid"
);
...
@@ -92,17 +217,17 @@ void GMSH_CutGridPlugin::catchErrorMessage(char *errorMessage) const
...
@@ -92,17 +217,17 @@ void GMSH_CutGridPlugin::catchErrorMessage(char *errorMessage) const
strcpy
(
errorMessage
,
"CutGrid failed..."
);
strcpy
(
errorMessage
,
"CutGrid failed..."
);
}
}
int
GMSH_CutGridPlugin
::
getNbU
()
const
int
GMSH_CutGridPlugin
::
getNbU
()
{
{
return
(
int
)
CutGridOptions_Number
[
9
].
def
;
return
(
int
)
CutGridOptions_Number
[
9
].
def
;
}
}
int
GMSH_CutGridPlugin
::
getNbV
()
const
int
GMSH_CutGridPlugin
::
getNbV
()
{
{
return
(
int
)
CutGridOptions_Number
[
10
].
def
;
return
(
int
)
CutGridOptions_Number
[
10
].
def
;
}
}
void
GMSH_CutGridPlugin
::
getPoint
(
int
iU
,
int
iV
,
double
*
X
)
const
void
GMSH_CutGridPlugin
::
getPoint
(
int
iU
,
int
iV
,
double
*
X
)
{
{
double
u
=
(
double
)
iU
/
(
double
)(
getNbU
()
-
1.
);
double
u
=
(
double
)
iU
/
(
double
)(
getNbU
()
-
1.
);
double
v
=
(
double
)
iV
/
(
double
)(
getNbV
()
-
1.
);
double
v
=
(
double
)
iV
/
(
double
)(
getNbV
()
-
1.
);
...
...
This diff is collapsed.
Click to expand it.
Plugin/CutGrid.h
+
19
−
3
View file @
bf413a02
...
@@ -29,6 +29,8 @@ extern "C"
...
@@ -29,6 +29,8 @@ extern "C"
class
GMSH_CutGridPlugin
:
public
GMSH_Post_Plugin
class
GMSH_CutGridPlugin
:
public
GMSH_Post_Plugin
{
{
static
void
callback
();
static
double
callbackXYZ
(
int
,
int
,
double
,
double
*
);
public:
public:
GMSH_CutGridPlugin
();
GMSH_CutGridPlugin
();
void
getName
(
char
*
name
)
const
;
void
getName
(
char
*
name
)
const
;
...
@@ -39,10 +41,24 @@ public:
...
@@ -39,10 +41,24 @@ public:
int
getNbOptions
()
const
;
int
getNbOptions
()
const
;
StringXNumber
*
getOption
(
int
iopt
);
StringXNumber
*
getOption
(
int
iopt
);
Post_View
*
execute
(
Post_View
*
);
Post_View
*
execute
(
Post_View
*
);
virtual
int
getNbU
()
const
;
virtual
int
getNbV
()
const
;
virtual
void
getPoint
(
int
iU
,
int
iV
,
double
*
X
)
const
;
virtual
Post_View
*
GenerateView
(
Post_View
*
v
)
const
;
virtual
Post_View
*
GenerateView
(
Post_View
*
v
)
const
;
static
int
getNbU
();
static
int
getNbV
();
static
void
getPoint
(
int
iU
,
int
iV
,
double
*
X
);
static
double
callbackX0
(
int
,
int
,
double
);
static
double
callbackY0
(
int
,
int
,
double
);
static
double
callbackZ0
(
int
,
int
,
double
);
static
double
callbackX1
(
int
,
int
,
double
);
static
double
callbackY1
(
int
,
int
,
double
);
static
double
callbackZ1
(
int
,
int
,
double
);
static
double
callbackX2
(
int
,
int
,
double
);
static
double
callbackY2
(
int
,
int
,
double
);
static
double
callbackZ2
(
int
,
int
,
double
);
static
double
callbackU
(
int
,
int
,
double
);
static
double
callbackV
(
int
,
int
,
double
);
static
void
draw
();
};
};
#endif
#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