Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
VR-demos
Commits
fea3947f
Commit
fea3947f
authored
Apr 21, 2017
by
Ruben Garcia Hernndez
Browse files
Add support for wget (https, etc) in CAVE
parent
7aed483c
Changes
2
Hide whitespace changes
Inline
Side-by-side
NOMADVRLib/atoms.cpp
View file @
fea3947f
...
...
@@ -325,7 +325,7 @@ r=sscanf (f, "http://%2047[^/:]:%d%2047[^\n]", host, &port, page);
if
(
r
==
1
)
r
=
sscanf
(
f
,
"http://%2047[^/]%2047[^
\n
]"
,
host
,
page
);
if
(
r
<
2
)
{
#if defined(WIN32)
#if defined(WIN32)
|| defined(CAVE)
//possibly https or other unsupported protocol, fall back to wget
return
readAtomsJsonURLwget
(
f
,
numatoms
,
timesteps
,
pos
,
abc
,
clonedAtoms
,
token
);
#else
...
...
@@ -387,23 +387,20 @@ while( conn.outstanding() )
#endif
fclose
(
out
);
#if defined(WIN32)
#if defined(WIN32)
|| defined(CAVE)
return
readAtomsJsonURLwget
(
f
,
numatoms
,
timesteps
,
pos
,
abc
,
clonedAtoms
,
token
);
#endif
return
-
3
;
}
fclose
(
out
);
//sprintf (cmd, "wget %s/cells -O material_cells.json", f);
//system(cmd);
//sprintf (cmd, "wget %s/elements -O material_elements.json", f);
//system(cmd);
char
file
[
2048
];
sprintf
(
file
,
"%s%s"
,
TMPDIR
,
"material"
);
//eprintf ("readAtomsJsonURL before return");
return
readAtomsJson
(
file
,
numatoms
,
timesteps
,
pos
,
abc
,
clonedAtoms
,
token
);
}
#if defined(WIN32)
#if defined(WIN32)
|| defined(CAVE)
//base64 encoded token
int
readAtomsJsonURLwget
(
const
char
*
const
f
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
,
float
abc
[
3
][
3
],
std
::
vector
<
float
>**
clonedAtoms
,
const
char
*
const
token
)
...
...
@@ -411,20 +408,21 @@ int readAtomsJsonURLwget (const char *const f, int **numatoms, int *timesteps, f
char
cmd
[
2048
];
int
ret
;
if
(
token
)
sprintf
(
cmd
,
"wget --header
\"
Authorization:Basic %s
\"
%s/cells?pagination=off -O material_cells.json"
,
token
,
f
);
sprintf
(
cmd
,
"wget
--no-check-certificate
--header
\"
Authorization:Basic %s
\"
%s/cells?pagination=off -O
%s/
material_cells.json"
,
token
,
f
,
TMPDIR
);
else
sprintf
(
cmd
,
"wget %s/cells?pagination=off -O material_cells.json"
,
f
);
sprintf
(
cmd
,
"wget %s/cells?pagination=off -O
%s/
material_cells.json"
,
f
,
TMPDIR
);
ret
=
system
(
cmd
);
if
(
ret
!=
0
)
return
(
-
3
);
if
(
token
)
sprintf
(
cmd
,
"wget --header
\"
Authorization:Basic %s
\"
%s/elements?pagination=off -O material_elements.json"
,
token
,
f
);
sprintf
(
cmd
,
"wget
--no-check-certificate
--header
\"
Authorization:Basic %s
\"
%s/elements?pagination=off -O
%s/
material_elements.json"
,
token
,
f
,
TMPDIR
);
else
sprintf
(
cmd
,
"wget %s/elements?pagination=off -O material_elements.json"
,
f
);
sprintf
(
cmd
,
"wget %s/elements?pagination=off -O
%s/
material_elements.json"
,
f
,
TMPDIR
);
ret
=
system
(
cmd
);
if
(
ret
!=
0
)
return
(
-
3
);
return
readAtomsJson
(
"material"
,
numatoms
,
timesteps
,
pos
,
abc
,
clonedAtoms
,
token
);
sprintf
(
cmd
,
"%s/material"
,
TMPDIR
);
return
readAtomsJson
(
cmd
,
numatoms
,
timesteps
,
pos
,
abc
,
clonedAtoms
,
token
);
}
#endif
...
...
NOMADVRLib/atoms.hpp
View file @
fea3947f
...
...
@@ -17,7 +17,7 @@ int readAtomsXYZ(const char *const file, int **numatoms, int *timesteps, float *
int
readAtomsCube
(
const
char
*
const
file
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
);
int
readAtomsJson
(
const
char
*
const
file
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
,
float
abc
[
3
][
3
],
std
::
vector
<
float
>**
clonedAtoms
,
const
char
*
const
token
=
0
);
int
readAtomsJsonURL
(
const
char
*
const
f
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
,
float
abc
[
3
][
3
],
std
::
vector
<
float
>**
clonedAtoms
,
const
char
*
const
token
=
0
);
#if defined(WIN32)
#if defined(WIN32)
|| defined(CAVE)
int
readAtomsJsonURLwget
(
const
char
*
const
f
,
int
**
numatoms
,
int
*
timesteps
,
float
***
pos
,
float
abc
[
3
][
3
],
std
::
vector
<
float
>**
clonedAtoms
,
const
char
*
const
token
=
0
);
#endif
const
float
MISSINGRADIUS
=
0.2
f
;
...
...
@@ -34,4 +34,4 @@ void discardline (FILE *F);
void
Clone
(
float
tmppos
[
3
],
float
k
,
std
::
vector
<
float
>*
clonedAtoms
);
void
TransformAtoms
(
std
::
vector
<
float
>*
clonedAtoms
,
const
float
abc
[
3
][
3
]);
#endif //__ATOMS_H
\ No newline at end of file
#endif //__ATOMS_H
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment