Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
LAMBERT Jean-charles
unsio
Commits
a071a86e
Commit
a071a86e
authored
Mar 18, 2016
by
LAMBERT Jean-charles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix gadget writing crash when saving gas properties before gas positions
parent
30d18914
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
41 deletions
+17
-41
src/snapshotgadget.cc
src/snapshotgadget.cc
+16
-10
src/snapshotinterface.cc
src/snapshotinterface.cc
+0
-23
src/snapshotinterface.h
src/snapshotinterface.h
+1
-2
src/snapshotlist.h
src/snapshotlist.h
+0
-3
src/snapshotsim.h
src/snapshotsim.h
+0
-3
No files found.
src/snapshotgadget.cc
View file @
a071a86e
...
...
@@ -2014,7 +2014,9 @@ int CSnapshotGadgetOut<T>::setAcc(std::string name, const int _n, T * _acc, cons
template
<
class
T
>
int
CSnapshotGadgetOut
<
T
>::
setRho
(
const
int
_n
,
T
*
_rho
,
const
bool
addr
)
{
assert
(
_n
==
header
.
npart
[
0
]);;
// #rho particles = #gas particles
if
(
header
.
npart
[
0
]
>
0
)
assert
(
_n
==
header
.
npart
[
0
]);;
// #rho particles = #gas particles
header
.
npart
[
0
]
=
_n
;
if
(
addr
)
{
// map address
rho
=
_rho
;
}
...
...
@@ -2032,8 +2034,8 @@ int CSnapshotGadgetOut<T>::setRho(const int _n, T * _rho, const bool addr)
template
<
class
T
>
int
CSnapshotGadgetOut
<
T
>::
setHsml
(
const
int
_n
,
T
*
_hsml
,
const
bool
addr
)
{
assert
(
_n
==
header
.
npart
[
0
]
);;
// #hsml particles = #gas particles
if
(
header
.
npart
[
0
]
>
0
)
assert
(
_n
==
header
.
npart
[
0
]);;
// #hsml particles = #gas particles
header
.
npart
[
0
]
=
_n
;
if
(
addr
)
{
// map address
hsml
=
_hsml
;
}
...
...
@@ -2050,9 +2052,9 @@ int CSnapshotGadgetOut<T>::setHsml(const int _n, T * _hsml, const bool addr)
// setU:
template
<
class
T
>
int
CSnapshotGadgetOut
<
T
>::
setU
(
const
int
_n
,
T
*
_U
,
const
bool
addr
)
{
assert
(
_n
==
header
.
npart
[
0
]
);;
// #U particles = #gas particles
{
if
(
header
.
npart
[
0
]
>
0
)
assert
(
_n
==
header
.
npart
[
0
]);;
// #U particles = #gas particles
header
.
npart
[
0
]
=
_n
;
if
(
addr
)
{
// map address
intenerg
=
_U
;
}
...
...
@@ -2071,7 +2073,8 @@ template <class T>
int
CSnapshotGadgetOut
<
T
>::
setTemp
(
const
int
_n
,
T
*
_temp
,
const
bool
addr
)
{
assert
(
_n
==
header
.
npart
[
0
]);;
// #U particles = #gas particles
if
(
header
.
npart
[
0
]
>
0
)
assert
(
_n
==
header
.
npart
[
0
]);;
// #U particles = #gas particles
header
.
npart
[
0
]
=
_n
;
if
(
addr
)
{
// map address
temp
=
_temp
;
}
...
...
@@ -2090,7 +2093,8 @@ template <class T>
int
CSnapshotGadgetOut
<
T
>::
setMetalGas
(
const
int
_n
,
T
*
_mg
,
const
bool
addr
)
{
assert
(
_n
==
header
.
npart
[
0
]);;
// #U particles = #gas particles
if
(
header
.
npart
[
0
]
>
0
)
assert
(
_n
==
header
.
npart
[
0
]);;
// #U particles = #gas particles
header
.
npart
[
0
]
=
_n
;
if
(
addr
)
{
// map address
metal
[
0
]
=
_mg
;
}
...
...
@@ -2109,7 +2113,8 @@ template <class T>
int
CSnapshotGadgetOut
<
T
>::
setMetalStars
(
const
int
_n
,
T
*
_ms
,
const
bool
addr
)
{
assert
(
_n
==
header
.
npart
[
4
]);;
// #metal stars particles
if
(
header
.
npart
[
4
]
>
0
)
assert
(
_n
==
header
.
npart
[
4
]);;
// #metal stars particles
header
.
npart
[
4
]
=
_n
;
if
(
addr
)
{
// map address
metal
[
4
]
=
_ms
;
}
...
...
@@ -2128,7 +2133,8 @@ template <class T>
int
CSnapshotGadgetOut
<
T
>::
setAge
(
const
int
_n
,
T
*
_age
,
const
bool
addr
)
{
assert
(
_n
==
header
.
npart
[
4
]);;
// #age stars particles
if
(
header
.
npart
[
4
]
>
0
)
assert
(
_n
==
header
.
npart
[
4
]);;
// #age stars particles
header
.
npart
[
4
]
=
_n
;
if
(
addr
)
{
// map address
age
=
_age
;
}
...
...
src/snapshotinterface.cc
View file @
a071a86e
...
...
@@ -248,29 +248,6 @@ template <class T> bool CSnapshotInterfaceIn<T>::checkRangeTime(const float curr
}
return
false
;
}
// ============================================================================
// shift
// shift Positions or Velocities
template
<
class
T
>
bool
CSnapshotInterfaceIn
<
T
>::
shift
(
std
::
string
name
,
const
float
x
,
const
float
y
,
const
float
z
)
{
T
*
data
;
if
(
name
!=
"pos"
&&
name
!=
"vel"
)
{
std
::
cerr
<<
"Error CSnapshotInterfaceIn::shift, name=["
<<
name
<<
"] sould be
\"
pos
\"
or
\"
vel
\"
\n
"
<<
"aborting....
\n
"
;
std
::
exit
(
1
);
}
int
nbody
;
bool
ok
=
getData
(
"all"
,
name
,
&
nbody
,
&
data
);
if
(
ok
)
{
for
(
int
i
=
0
;
i
<
nbody
;
i
++
)
{
data
[
i
*
3
+
0
]
+=
x
;
data
[
i
*
3
+
1
]
+=
y
;
data
[
i
*
3
+
2
]
+=
z
;
}
}
return
ok
;
}
// ============================================================================
// getRangeSelect
// ============================================================================
...
...
src/snapshotinterface.h
View file @
a071a86e
...
...
@@ -124,8 +124,7 @@ namespace uns {
virtual
void
setNsel
(
const
int
_nsel
)
{
nsel
=
_nsel
;}
virtual
bool
isNewFrame
()
{
return
true
;}
virtual
int
nextFrame
(
std
::
string
bits
=
""
);
//mxvpaekXRMAHIU");
virtual
ComponentRangeVector
*
getCrvFromSelection
()
{
return
user_select
.
getCrvFromSelection
();}
virtual
bool
shift
(
std
::
string
,
const
float
x
,
const
float
y
,
const
float
z
);
virtual
ComponentRangeVector
*
getCrvFromSelection
()
{
return
user_select
.
getCrvFromSelection
();}
virtual
T
getEps
(
const
std
::
string
)
{
return
-
1.
;}
virtual
int
getCod
(
const
std
::
string
select
,
const
float
time
,
float
*
tcod
,
const
std
::
string
base
=
"ANALYSIS/cod"
,
...
...
src/snapshotlist.h
View file @
a071a86e
...
...
@@ -51,9 +51,6 @@ namespace uns {
else
return
CSnapshotInterfaceIn
<
T
>::
getFileName
();
}
bool
isNewFrame
();
bool
shift
(
std
::
string
name
,
const
float
x
,
const
float
y
,
const
float
z
)
{
return
snapshot
->
shift
(
name
,
x
,
y
,
z
);
}
virtual
ComponentRangeVector
*
getCrvFromSelection
()
{
return
snapshot
->
user_select
.
getCrvFromSelection
();}
//bool isNewFrame();
...
...
src/snapshotsim.h
View file @
a071a86e
...
...
@@ -54,9 +54,6 @@ namespace uns {
assert
(
0
);
return
""
;
}
bool
shift
(
std
::
string
name
,
const
float
x
,
const
float
y
,
const
float
z
)
{
return
snapshot
->
shift
(
name
,
x
,
y
,
z
);
}
bool
isNewFrame
();
virtual
ComponentRangeVector
*
getCrvFromSelection
()
{
return
snapshot
->
user_select
.
getCrvFromSelection
();}
virtual
int
getCod
(
const
std
::
string
select
,
const
float
time
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment