Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
miscmaths
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
Container Registry
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
miscmaths
Commits
1ddffee6
Commit
1ddffee6
authored
16 years ago
by
Jesper Andersson
Browse files
Options
Downloads
Patches
Plain Diff
Added assignment operator
parent
60d67031
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
splinterpolator.h
+27
-1
27 additions, 1 deletion
splinterpolator.h
with
27 additions
and
1 deletion
splinterpolator.h
+
27
−
1
View file @
1ddffee6
...
...
@@ -60,6 +60,9 @@ public:
// Destructor
virtual
~
Splinterpolator
()
{
if
(
_own_coef
)
delete
[]
_coef
;
}
// Assignment. May be removed in future
Splinterpolator
&
operator
=
(
const
Splinterpolator
&
s
);
// Set new data in Splinterpolator.
void
Set
(
const
T
*
data
,
const
std
::
vector
<
unsigned
int
>&
dim
,
const
std
::
vector
<
ExtrapolationType
>&
et
,
unsigned
int
order
=
3
,
bool
copy_low_order
=
true
,
double
prec
=
1e-8
)
{
...
...
@@ -201,7 +204,7 @@ private:
// Disallowed member functions
//
Splinterpolator
(
const
Splinterpolator
&
s
);
// Don't allow copy-construction
Splinterpolator
&
operator
=
(
const
Splinterpolator
&
s
);
// Don't allow assignment
//
Splinterpolator& operator=(const Splinterpolator& s); // Don't allow assignment
};
/////////////////////////////////////////////////////////////////////
...
...
@@ -210,6 +213,29 @@ private:
//
/////////////////////////////////////////////////////////////////////
template
<
class
T
>
Splinterpolator
<
T
>&
Splinterpolator
<
T
>::
operator
=
(
const
Splinterpolator
<
T
>&
src
)
{
if
(
_own_coef
)
delete
[]
_coef
;
_valid
=
src
.
_valid
;
_own_coef
=
src
.
_own_coef
;
_cptr
=
src
.
_cptr
;
_order
=
src
.
_order
;
_ndim
=
src
.
_ndim
;
_prec
=
src
.
_prec
;
_dim
=
src
.
_dim
;
_et
=
src
.
_et
;
if
(
_own_coef
)
{
// If we need to do a deep copy
unsigned
int
ts
=
1
;
for
(
unsigned
int
i
=
0
;
i
<
_ndim
;
i
++
)
ts
*=
_dim
[
i
];
_coef
=
new
T
[
ts
];
memcpy
(
_coef
,
src
.
_coef
,
ts
*
sizeof
(
T
));
}
return
(
*
this
);
}
/////////////////////////////////////////////////////////////////////
//
// Returns interpolated value at location coord.
...
...
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