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
Releases
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yuhao Liu
ogs
Commits
2eed8779
Commit
2eed8779
authored
Feb 12, 2016
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[PL] Move getting of mesh property in process var.
parent
2fec8952
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
ProcessLib/Process.h
+2
-22
2 additions, 22 deletions
ProcessLib/Process.h
ProcessLib/ProcessVariable.cpp
+20
-0
20 additions, 0 deletions
ProcessLib/ProcessVariable.cpp
ProcessLib/ProcessVariable.h
+4
-0
4 additions, 0 deletions
ProcessLib/ProcessVariable.h
with
26 additions
and
22 deletions
ProcessLib/Process.h
+
2
−
22
View file @
2eed8779
...
@@ -272,31 +272,11 @@ private:
...
@@ -272,31 +272,11 @@ private:
_x
->
copyValues
(
x_copy
);
_x
->
copyValues
(
x_copy
);
std
::
size_t
const
n
=
_mesh
.
getNNodes
();
std
::
size_t
const
n
=
_mesh
.
getNNodes
();
for
(
ProcessVariable
const
&
pv
:
_process_variables
)
for
(
ProcessVariable
&
pv
:
_process_variables
)
{
std
::
string
const
property_name
=
pv
.
getName
();
// Get or create a property vector for results.
boost
::
optional
<
MeshLib
::
PropertyVector
<
double
>&>
result
;
if
(
_mesh
.
getProperties
().
hasPropertyVector
(
property_name
))
{
result
=
_mesh
.
getProperties
().
template
getPropertyVector
<
double
>(
property_name
);
}
else
{
{
result
=
_mesh
.
getProperties
()
auto
&
output_data
=
pv
.
getOrCreateMeshProperty
();
.
template
createNewPropertyVector
<
double
>(
property_name
,
MeshLib
::
MeshItemType
::
Node
);
}
assert
(
result
);
int
const
n_components
=
pv
.
getTupleSize
();
int
const
n_components
=
pv
.
getTupleSize
();
// result's resize function is from std::vector not accounting the
// tuple size.
result
->
resize
(
x_copy
.
size
()
*
n_components
);
for
(
std
::
size_t
i
=
0
;
i
<
n
;
++
i
)
for
(
std
::
size_t
i
=
0
;
i
<
n
;
++
i
)
{
{
MeshLib
::
Location
const
l
(
_mesh
.
getID
(),
MeshLib
::
Location
const
l
(
_mesh
.
getID
(),
...
...
This diff is collapsed.
Click to expand it.
ProcessLib/ProcessVariable.cpp
+
20
−
0
View file @
2eed8779
...
@@ -114,4 +114,24 @@ MeshLib::Mesh const& ProcessVariable::getMesh() const
...
@@ -114,4 +114,24 @@ MeshLib::Mesh const& ProcessVariable::getMesh() const
return
_mesh
;
return
_mesh
;
}
}
MeshLib
::
PropertyVector
<
double
>&
ProcessVariable
::
getOrCreateMeshProperty
()
{
boost
::
optional
<
MeshLib
::
PropertyVector
<
double
>&>
result
;
if
(
_mesh
.
getProperties
().
hasPropertyVector
(
_name
))
{
result
=
_mesh
.
getProperties
().
template
getPropertyVector
<
double
>(
_name
);
assert
(
result
);
assert
(
result
->
size
()
==
_mesh
.
getNNodes
()
*
_tuple_size
);
}
else
{
result
=
_mesh
.
getProperties
().
template
createNewPropertyVector
<
double
>(
_name
,
MeshLib
::
MeshItemType
::
Node
);
assert
(
result
);
result
->
resize
(
_mesh
.
getNNodes
()
*
_tuple_size
);
}
return
*
result
;
}
}
// namespace ProcessLib
}
// namespace ProcessLib
This diff is collapsed.
Click to expand it.
ProcessLib/ProcessVariable.h
+
4
−
0
View file @
2eed8779
...
@@ -96,6 +96,10 @@ public:
...
@@ -96,6 +96,10 @@ public:
return
_initial_condition
->
getValue
(
n
,
component_id
);
return
_initial_condition
->
getValue
(
n
,
component_id
);
}
}
// Get or create a property vector for results.
// The returned mesh property size is number of mesh nodes times tuple size.
MeshLib
::
PropertyVector
<
double
>&
getOrCreateMeshProperty
();
private
:
private
:
std
::
string
const
_name
;
std
::
string
const
_name
;
MeshLib
::
Mesh
&
_mesh
;
MeshLib
::
Mesh
&
_mesh
;
...
...
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