Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mojtaba Abdolkhani
ogs
Commits
3bcfe4a6
Commit
3bcfe4a6
authored
9 years ago
by
Lars Bilke
Browse files
Options
Downloads
Plain Diff
Merge pull request #1112 from rinkk/MshModelMemSave
Static string references for MshModel
parents
99fee93e
11e7ebac
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
Applications/DataExplorer/DataView/MshModel.cpp
+22
-19
22 additions, 19 deletions
Applications/DataExplorer/DataView/MshModel.cpp
Applications/DataExplorer/DataView/MshModel.h
+6
-0
6 additions, 0 deletions
Applications/DataExplorer/DataView/MshModel.h
with
28 additions
and
19 deletions
Applications/DataExplorer/DataView/MshModel.cpp
+
22
−
19
View file @
3bcfe4a6
...
...
@@ -32,13 +32,15 @@
#include
"Elements/Element.h"
#include
"MeshEnums.h"
const
QVariant
MshModel
::
element_str
=
"Element"
;
const
std
::
map
<
MeshLib
::
MeshElemType
,
QVariant
>
MshModel
::
elem_type_map
=
MshModel
::
createMeshElemTypeMap
();
MshModel
::
MshModel
(
ProjectData
&
project
,
QObject
*
parent
/*= 0*/
)
:
TreeModel
(
parent
),
_project
(
project
)
{
delete
_rootItem
;
QList
<
QVariant
>
rootData
;
rootData
<<
"Mesh Name"
<<
"
Type
"
<<
"
Node IDs
"
;
rootData
<<
"Mesh Name"
<<
"
#
"
<<
"
Type
"
;
_rootItem
=
new
TreeItem
(
rootData
,
nullptr
);
}
...
...
@@ -46,7 +48,7 @@ int MshModel::columnCount( const QModelIndex &parent /*= QModelIndex()*/ ) const
{
Q_UNUSED
(
parent
)
return
2
;
return
3
;
}
void
MshModel
::
addMesh
(
MeshLib
::
Mesh
*
mesh
)
...
...
@@ -58,31 +60,21 @@ void MshModel::addMesh(MeshLib::Mesh* mesh)
void
MshModel
::
addMeshObject
(
const
MeshLib
::
Mesh
*
mesh
)
{
INFO
(
"name: %s"
,
mesh
->
getName
().
c_str
());
Q
String
display_name
(
QString
::
fromStdString
(
mesh
->
getName
()));
Q
Variant
const
display_name
(
QString
::
fromStdString
(
mesh
->
getName
()));
QList
<
QVariant
>
meshData
;
meshData
<<
display_name
<<
""
;
MshItem
*
newMesh
=
new
MshItem
(
meshData
,
_rootItem
,
mesh
);
meshData
<<
display_name
<<
""
<<
""
;
MshItem
*
const
newMesh
=
new
MshItem
(
meshData
,
_rootItem
,
mesh
);
_rootItem
->
appendChild
(
newMesh
);
// display elements
const
std
::
vector
<
MeshLib
::
Element
*>
&
elems
=
mesh
->
getElements
();
const
std
::
size_t
nElems
(
elems
.
size
());
QString
elem_type_string
(
""
);
MeshLib
::
MeshElemType
elem_type
(
MeshLib
::
MeshElemType
::
INVALID
);
std
::
vector
<
MeshLib
::
Element
*>
const
&
elems
=
mesh
->
getElements
();
int
const
nElems
(
static_cast
<
int
>
(
elems
.
size
()));
for
(
std
::
size_
t
i
=
0
;
i
<
nElems
;
i
++
)
for
(
in
t
i
=
0
;
i
<
nElems
;
i
++
)
{
const
MeshLib
::
Element
*
current_element
(
elems
[
i
]);
MeshLib
::
MeshElemType
t
(
current_element
->
getGeomType
());
QList
<
QVariant
>
elemData
;
elemData
.
reserve
(
3
);
if
(
t
!=
elem_type
)
{
elem_type
=
t
;
elem_type_string
=
QString
::
fromStdString
(
MeshElemType2String
(
t
));
}
elemData
<<
"Element "
+
QString
::
number
(
i
)
<<
elem_type_string
;
elemData
<<
element_str
<<
i
<<
elem_type_map
.
at
(
elems
[
i
]
->
getGeomType
());
newMesh
->
appendChild
(
new
TreeItem
(
elemData
,
newMesh
));
}
...
...
@@ -168,6 +160,17 @@ void MshModel::updateModel()
addMeshObject
(
*
it
);
}
std
::
map
<
MeshLib
::
MeshElemType
,
QVariant
>
MshModel
::
createMeshElemTypeMap
()
{
std
::
vector
<
MeshLib
::
MeshElemType
>
const
&
elem_types
(
MeshLib
::
getMeshElemTypes
());
std
::
map
<
MeshLib
::
MeshElemType
,
QVariant
>
elem_map
;
for
(
MeshLib
::
MeshElemType
t
:
elem_types
)
elem_map
[
t
]
=
QVariant
(
QString
::
fromStdString
(
MeshLib
::
MeshElemType2String
(
t
)));
return
elem_map
;
}
vtkUnstructuredGridAlgorithm
*
MshModel
::
vtkSource
(
const
QModelIndex
&
idx
)
const
{
if
(
idx
.
isValid
())
...
...
This diff is collapsed.
Click to expand it.
Applications/DataExplorer/DataView/MshModel.h
+
6
−
0
View file @
3bcfe4a6
...
...
@@ -69,6 +69,12 @@ private:
//bool isUniqueMeshName(std::string &name);
ProjectData
&
_project
;
/// Creates a static map of all element type name-strings in QVariant format
static
std
::
map
<
MeshLib
::
MeshElemType
,
QVariant
>
createMeshElemTypeMap
();
static
const
std
::
map
<
MeshLib
::
MeshElemType
,
QVariant
>
elem_type_map
;
static
const
QVariant
element_str
;
signals:
void
meshAdded
(
MshModel
*
,
const
QModelIndex
&
);
void
meshRemoved
(
MshModel
*
,
const
QModelIndex
&
);
...
...
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