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
721f0d79
Commit
721f0d79
authored
15 years ago
by
Jonathan Lambrechts
Browse files
Options
Downloads
Patches
Plain Diff
add dataCacheMap::parent
parent
ea7e9b15
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Solver/function.cpp
+25
-3
25 additions, 3 deletions
Solver/function.cpp
Solver/function.h
+14
-4
14 additions, 4 deletions
Solver/function.h
with
39 additions
and
7 deletions
Solver/function.cpp
+
25
−
3
View file @
721f0d79
...
...
@@ -65,14 +65,33 @@ void dataCacheDouble::resize() {
//dataCacheMap members
dataCacheDouble
&
dataCacheMap
::
get
(
const
function
*
f
,
dataCacheDouble
*
caller
)
{
dataCacheDouble
*&
r
=
_cacheDoubleMap
[
f
];
if
(
r
==
NULL
)
dataCacheDouble
*&
r
=
_cacheDoubleMap
[
f
];
if
(
r
==
NULL
&&
_parent
)
{
std
::
map
<
const
function
*
,
dataCacheDouble
*>::
iterator
it
=
_parent
->
_cacheDoubleMap
.
find
(
f
);
if
(
it
!=
_parent
->
_cacheDoubleMap
.
end
())
{
r
=
it
->
second
;
for
(
std
::
set
<
dataCacheDouble
*>::
iterator
dep
=
r
->
_iDependOn
.
begin
();
dep
!=
r
->
_iDependOn
.
end
();
dep
++
)
{
if
(
&
(
*
dep
)
->
_cacheMap
==
this
)
{
r
=
NULL
;
break
;
}
}
}
}
if
(
r
==
NULL
)
r
=
new
dataCacheDouble
(
this
,
const_cast
<
function
*>
(
f
));
if
(
caller
)
if
(
caller
)
r
->
addMeAsDependencyOf
(
caller
);
return
*
r
;
}
dataCacheDouble
&
dataCacheMap
::
substitute
(
const
function
*
f
)
{
dataCacheDouble
*&
r
=
_cacheDoubleMap
[
f
];
r
=
new
dataCacheDouble
(
this
,
const_cast
<
function
*>
(
f
));
return
*
r
;
}
dataCacheMap
::~
dataCacheMap
()
{
for
(
std
::
set
<
dataCacheDouble
*>::
iterator
it
=
_toDelete
.
begin
();
...
...
@@ -333,6 +352,9 @@ void dataCacheMap::setNbEvaluationPoints(int nbEvaluationPoints) {
(
*
it
)
->
resize
();
(
*
it
)
->
_valid
=
false
;
}
for
(
std
::
list
<
dataCacheMap
*>::
iterator
it
=
_children
.
begin
();
it
!=
_children
.
end
();
it
++
)
{
(
*
it
)
->
setNbEvaluationPoints
(
nbEvaluationPoints
);
}
}
//functionC
...
...
This diff is collapsed.
Click to expand it.
Solver/function.h
+
14
−
4
View file @
721f0d79
...
...
@@ -4,6 +4,7 @@
#include
"fullMatrix.h"
#include
<map>
#include
<set>
#include
<list>
#include
<string>
#include
<vector>
class
dataCacheMap
;
...
...
@@ -143,10 +144,9 @@ public :
// more explanation at the head of this file
class
dataCacheMap
{
friend
class
dataCacheDouble
;
private:
dataCacheMap
*
_parent
;
std
::
list
<
dataCacheMap
*>
_children
;
int
_nbEvaluationPoints
;
// keep track of the current element and all the dataCaches that
// depend on it
std
::
map
<
const
function
*
,
dataCacheDouble
*>
_cacheDoubleMap
;
std
::
set
<
dataCacheDouble
*>
_toDelete
;
std
::
set
<
dataCacheDouble
*>
_toResize
;
...
...
@@ -165,14 +165,24 @@ class dataCacheMap {
}
public
:
dataCacheDouble
&
get
(
const
function
*
f
,
dataCacheDouble
*
caller
=
0
);
dataCacheDouble
&
substitute
(
const
function
*
f
);
inline
void
setElement
(
MElement
*
element
)
{
_element
=
element
;
for
(
std
::
set
<
dataCacheDouble
*>::
iterator
it
=
_toInvalidateOnElement
.
begin
();
it
!=
_toInvalidateOnElement
.
end
();
it
++
)
{
(
*
it
)
->
_valid
=
false
;
}
for
(
std
::
list
<
dataCacheMap
*>::
iterator
it
=
_children
.
begin
();
it
!=
_children
.
end
();
it
++
)
{
(
*
it
)
->
setElement
(
element
);
}
}
inline
MElement
*
getElement
()
{
return
_element
;}
dataCacheMap
(){
dataCacheMap
()
{
_nbEvaluationPoints
=
0
;
_parent
=
NULL
;
}
dataCacheMap
(
dataCacheMap
*
parent
)
{
_parent
=
parent
;
_parent
->
_children
.
push_back
(
this
);
_nbEvaluationPoints
=
0
;
}
void
setNbEvaluationPoints
(
int
nbEvaluationPoints
);
...
...
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