SimpleFastOpenAtomicVisualiser
Loading...
Searching...
No Matches
structureUtils.h
Go to the documentation of this file.
1#ifndef STRUCTUREUTILS_H
2#define STRUCTUREUTILS_H
3
4#include <memory>
5
6#include <xyz.h>
7#include <config.h>
8
19(
20 std::filesystem::path path,
21 std::unique_ptr<Structure> & structure,
22 bool blocking = false
23)
24{
25 if (!ostensiblyXYZLike(path))
26 {
27 if (!ostensiblyCONFIGLike(path))
28 {
29 std::cout << path << " does not appear to refer to an [EXT]XYZ or CONFIG-like\n";
30 }
31 try
32 {
33 structure = std::make_unique<CONFIG>(path, blocking);
34 }
35 catch (std::runtime_error & e)
36 {
37 std::cout << "Could not parse "
38 << path
39 << " as a CONFIG-like:\n"
40 << e.what() << "\n Trying [EXT]XYZ\n";
41 structure = std::make_unique<XYZ>(path, blocking);
42 }
43 }
44 else
45 {
46 try
47 {
48 structure = std::make_unique<XYZ>(path, blocking);
49 }
50 catch (std::runtime_error & e)
51 {
52 std::cout << "Could not parse "
53 << path
54 << " as an [EXT]XYZ:\n"
55 << e.what() << "\n Trying CONFIG-like\n";
56 structure = std::make_unique<CONFIG>(path, blocking);
57 }
58 }
59}
60
61#endif /* STRUCTUREUTILS_H */
glm::vec< L, float, glm::qualifier::highp > vec
Definition commandLine.h:214
bool ostensiblyCONFIGLike(std::filesystem::path path)
Check if a path is CONFIG'y.
Definition config.h:24
void readStructureFile(std::filesystem::path path, std::unique_ptr< Structure > &structure, bool blocking=false)
Read a structure file from the path.
Definition structureUtils.h:19
bool ostensiblyXYZLike(std::filesystem::path path)
Check if a path is XYZ'y.
Definition xyz.h:21