Commit 7fe9c87b by Maarten L. Hekkelman

Some small fixes for windows

parent 9b2ae6d7
......@@ -95,11 +95,13 @@ class sac_parser
{
auto s = text.begin();
bool result = is_ordinary(*s++);
while (result and s != text.end())
bool result = true;
for (auto ch : text)
{
result = is_non_blank(*s);
++s;
if (is_non_blank(ch))
continue;
result = false;
break;
}
// but be careful it does not contain e.g. stop_
......
......@@ -1688,6 +1688,9 @@ atom &structure::emplace_atom(atom &&atom)
R = i - 1;
}
if (R == -1) // msvc...
m_atom_index.insert(m_atom_index.begin(), m_atoms.size());
else
m_atom_index.insert(m_atom_index.begin() + R + 1, m_atoms.size());
// make sure the atom_type is known
......
......@@ -87,17 +87,17 @@ class Matrix : public MatrixExpression<Matrix>
Matrix &operator=(Matrix &&m) = default;
Matrix &operator=(const Matrix &m) = default;
uint32_t dim_m() const { return m_m; }
uint32_t dim_n() const { return m_n; }
size_t dim_m() const { return m_m; }
size_t dim_n() const { return m_n; }
double operator()(uint32_t i, uint32_t j) const
double operator()(size_t i, size_t j) const
{
assert(i < m_m);
assert(j < m_n);
return m_data[i * m_n + j];
}
double &operator()(uint32_t i, uint32_t j)
double &operator()(size_t i, size_t j)
{
assert(i < m_m);
assert(j < m_n);
......@@ -105,7 +105,7 @@ class Matrix : public MatrixExpression<Matrix>
}
private:
uint32_t m_m = 0, m_n = 0;
size_t m_m = 0, m_n = 0;
std::vector<double> m_data;
};
......@@ -522,15 +522,17 @@ quaternion align_points(const std::vector<point> &pa, const std::vector<point> &
point nudge(point p, float offset)
{
static const float kPI_f = static_cast<float>(kPI);
static std::random_device rd;
static std::mt19937_64 rng(rd());
std::uniform_real_distribution<float> randomAngle(0, 2 * kPI);
std::normal_distribution<> randomOffset(0, offset);
std::uniform_real_distribution<float> randomAngle(0, 2 * kPI_f);
std::normal_distribution<float> randomOffset(0, offset);
float theta = randomAngle(rng);
float phi1 = randomAngle(rng) - kPI;
float phi2 = randomAngle(rng) - kPI;
float phi1 = randomAngle(rng) - kPI_f;
float phi2 = randomAngle(rng) - kPI_f;
quaternion q = spherical(1.0f, theta, phi1, phi2);
......
......@@ -58,6 +58,12 @@ bool init_unit_test()
// not a test, just initialize test dir
if (boost::unit_test::framework::master_test_suite().argc == 2)
gTestDir = boost::unit_test::framework::master_test_suite().argv[1];
else
{
while (not gTestDir.empty() and not std::filesystem::exists(gTestDir / "test"))
gTestDir = gTestDir.parent_path();
gTestDir /= "test";
}
// do this now, avoids the need for installing
cif::add_file_resource("mmcif_pdbx.dic", gTestDir / ".." / "rsrc" / "mmcif_pdbx.dic");
......
......@@ -39,6 +39,12 @@ int main(int argc, char* argv[])
if (argc == 3)
testdir = argv[2];
else
{
while (not testdir.empty() and not std::filesystem::exists(testdir / "test"))
testdir = testdir.parent_path();
testdir /= "test";
}
if (std::filesystem::exists(testdir / ".." / "data" / "ccd-subset.cif"))
cif::add_file_resource("components.cif", testdir / ".." / "data" / "ccd-subset.cif");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment