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
5f699c01
Commit
5f699c01
authored
12 years ago
by
Ruth Sabariego
Browse files
Options
Downloads
Patches
Plain Diff
Creating a new view from mesh with a Plugin...
parent
5e63ca63
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/NewView.cpp
+60
-0
60 additions, 0 deletions
Plugin/NewView.cpp
Plugin/NewView.h
+31
-0
31 additions, 0 deletions
Plugin/NewView.h
with
91 additions
and
0 deletions
Plugin/NewView.cpp
0 → 100644
+
60
−
0
View file @
5f699c01
// Gmsh - Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
//
// Contributor(s):
// Ruth Sabariego & Francois Henrotte
//
#include
"NewView.h"
#include
"GModel.h"
#include
"MElement.h"
StringXNumber
NewViewOptions_Number
[]
=
{
{
GMSH_FULLRC
,
"View"
,
NULL
,
-
1.
}
};
extern
"C"
{
GMSH_Plugin
*
GMSH_RegisterNewViewPlugin
()
{
return
new
GMSH_NewViewPlugin
();
}
}
std
::
string
GMSH_NewViewPlugin
::
getHelp
()
const
{
return
"Plugin(NewView) creates a new view from a mesh."
;
}
int
GMSH_NewViewPlugin
::
getNbOptions
()
const
{
return
sizeof
(
NewViewOptions_Number
)
/
sizeof
(
StringXNumber
);
}
StringXNumber
*
GMSH_NewViewPlugin
::
getOption
(
int
iopt
)
{
return
&
NewViewOptions_Number
[
iopt
];
}
PView
*
GMSH_NewViewPlugin
::
execute
(
PView
*
v
)
{
if
(
GModel
::
current
()
->
getMeshStatus
()
<
1
){
Msg
::
Error
(
"No mesh available to create the view: please mesh your model!"
);
return
v
;
}
std
::
map
<
int
,
std
::
vector
<
double
>
>
d
;
std
::
vector
<
GEntity
*>
entities
;
GModel
::
current
()
->
getEntities
(
entities
);
for
(
unsigned
int
i
=
0
;
i
<
entities
.
size
();
i
++
){
for
(
unsigned
int
j
=
0
;
j
<
entities
[
i
]
->
mesh_vertices
.
size
();
j
++
){
MVertex
*
ve
=
entities
[
i
]
->
mesh_vertices
[
j
];
d
[
ve
->
getNum
()].
push_back
(
0.
);
}
}
PView
*
vn
=
new
PView
(
"New view"
,
"NodeData"
,
GModel
::
current
(),
d
);
return
vn
;
}
This diff is collapsed.
Click to expand it.
Plugin/NewView.h
0 → 100644
+
31
−
0
View file @
5f699c01
// Gmsh - Copyright (C) 1997-2012 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// bugs and problems to <gmsh@geuz.org>.
#ifndef _NEWVIEW_H_
#define _NEWVIEW_H_
#include
"Plugin.h"
extern
"C"
{
GMSH_Plugin
*
GMSH_RegisterNewViewPlugin
();
}
class
GMSH_NewViewPlugin
:
public
GMSH_PostPlugin
{
public:
GMSH_NewViewPlugin
(){}
std
::
string
getName
()
const
{
return
"NewView"
;
}
std
::
string
getShortHelp
()
const
{
return
"Create an empty New View from a mesh"
;
}
std
::
string
getHelp
()
const
;
int
getNbOptions
()
const
;
StringXNumber
*
getOption
(
int
iopt
);
PView
*
execute
(
PView
*
);
};
#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