Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lammps
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
multiscale
lammps
Commits
e3cf0183
Commit
e3cf0183
authored
14 years ago
by
sjplimp
Browse files
Options
Downloads
Patches
Plain Diff
git-svn-id:
svn://svn.icms.temple.edu/lammps-ro/trunk@5834
f3b2605a-c512-4ea7-a41b-209d697bcdaa
parent
50b8413f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/memory.h
+8
-6
8 additions, 6 deletions
src/memory.h
with
8 additions
and
6 deletions
src/memory.h
+
8
−
6
View file @
e3cf0183
...
@@ -103,7 +103,7 @@ class Memory : protected Pointers {
...
@@ -103,7 +103,7 @@ class Memory : protected Pointers {
{
{
bigint
nbytes
=
sizeof
(
TYPE
)
*
(
nhi
-
nlo
+
1
);
bigint
nbytes
=
sizeof
(
TYPE
)
*
(
nhi
-
nlo
+
1
);
array
=
(
TYPE
*
)
smalloc
(
nbytes
,
name
);
array
=
(
TYPE
*
)
smalloc
(
nbytes
,
name
);
array
=
array
-
nlo
;
array
-
=
nlo
;
return
array
;
return
array
;
}
}
...
@@ -118,7 +118,7 @@ class Memory : protected Pointers {
...
@@ -118,7 +118,7 @@ class Memory : protected Pointers {
template
<
typename
TYPE
>
template
<
typename
TYPE
>
void
destroy1d_offset
(
TYPE
*
array
,
int
offset
)
void
destroy1d_offset
(
TYPE
*
array
,
int
offset
)
{
{
if
(
array
)
sfree
(
array
+
offset
);
if
(
array
)
sfree
(
&
array
[
offset
]
);
}
}
/* ----------------------------------------------------------------------
/* ----------------------------------------------------------------------
...
@@ -302,7 +302,8 @@ class Memory : protected Pointers {
...
@@ -302,7 +302,8 @@ class Memory : protected Pointers {
{
{
int
n1
=
n1hi
-
n1lo
+
1
;
int
n1
=
n1hi
-
n1lo
+
1
;
create
(
array
,
n1
,
n2
,
n3
,
name
);
create
(
array
,
n1
,
n2
,
n3
,
name
);
return
array
-
n1lo
;
array
-=
n1lo
;
return
array
;
}
}
template
<
typename
TYPE
>
template
<
typename
TYPE
>
...
@@ -317,7 +318,7 @@ class Memory : protected Pointers {
...
@@ -317,7 +318,7 @@ class Memory : protected Pointers {
template
<
typename
TYPE
>
template
<
typename
TYPE
>
void
destroy3d_offset
(
TYPE
***
array
,
int
offset
)
void
destroy3d_offset
(
TYPE
***
array
,
int
offset
)
{
{
if
(
array
)
destroy
(
array
+
offset
);
if
(
array
)
destroy
(
&
array
[
offset
]
);
}
}
/* ----------------------------------------------------------------------
/* ----------------------------------------------------------------------
...
@@ -340,7 +341,8 @@ class Memory : protected Pointers {
...
@@ -340,7 +341,8 @@ class Memory : protected Pointers {
for
(
int
i
=
0
;
i
<
n1
*
n2
;
i
++
)
array
[
0
][
i
]
-=
n3lo
;
for
(
int
i
=
0
;
i
<
n1
*
n2
;
i
++
)
array
[
0
][
i
]
-=
n3lo
;
for
(
int
i
=
0
;
i
<
n1
;
i
++
)
array
[
i
]
-=
n2lo
;
for
(
int
i
=
0
;
i
<
n1
;
i
++
)
array
[
i
]
-=
n2lo
;
return
array
-
n1lo
;
array
-=
n1lo
;
return
array
;
}
}
template
<
typename
TYPE
>
template
<
typename
TYPE
>
...
@@ -360,7 +362,7 @@ class Memory : protected Pointers {
...
@@ -360,7 +362,7 @@ class Memory : protected Pointers {
if
(
array
==
NULL
)
return
;
if
(
array
==
NULL
)
return
;
sfree
(
&
array
[
n1_offset
][
n2_offset
][
n3_offset
]);
sfree
(
&
array
[
n1_offset
][
n2_offset
][
n3_offset
]);
sfree
(
&
array
[
n1_offset
][
n2_offset
]);
sfree
(
&
array
[
n1_offset
][
n2_offset
]);
sfree
(
array
+
n1_offset
);
sfree
(
&
array
[
n1_offset
]
);
}
}
/* ----------------------------------------------------------------------
/* ----------------------------------------------------------------------
...
...
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