Skip to content

Commit

Permalink
Replace prepare
Browse files Browse the repository at this point in the history
  • Loading branch information
janbridley committed Oct 26, 2024
1 parent f59ce23 commit 2cc36c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions freud/order/Cubatic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ tensor4 Cubatic::calculateGlobalTensor(quat<float>* orientations) const
void Cubatic::compute(quat<float>* orientations, unsigned int num_orientations)
{
m_n = num_orientations;
m_particle_order_parameter.prepare(m_n);
// m_particle_order_parameter.prepare(m_n);
m_particle_order_parameter = std::make_shared<util::ManagedArray<float>>(std::vector<size_t> {m_n});

// Calculate the per-particle tensor
tensor4 global_tensor = calculateGlobalTensor(orientations);
m_global_tensor.prepare({3, 3, 3, 3});
// m_global_tensor.prepare({3, 3, 3, 3});
m_global_tensor = std::make_shared<util::ManagedArray<float>>(std::vector<size_t> {3, 3, 3, 3});
global_tensor.copyToManagedArray(m_global_tensor);

// The paper recommends using a Newton-Raphson scheme to optimize the order
Expand Down Expand Up @@ -329,7 +331,8 @@ void Cubatic::compute(quat<float>* orientations, unsigned int num_orientations)
}
}

m_cubatic_tensor.prepare({3, 3, 3, 3});
// m_cubatic_tensor.prepare({3, 3, 3, 3});
m_cubatic_tensor = std::make_shared<util::ManagedArray<float>>(std::vector<size_t> {3, 3, 3, 3});
p_cubatic_tensor[max_idx].copyToManagedArray(m_cubatic_tensor);
m_cubatic_orientation = p_cubatic_orientation[max_idx];
m_cubatic_order_parameter = p_cubatic_order_parameter[max_idx];
Expand Down
6 changes: 3 additions & 3 deletions freud/order/Cubatic.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ class Cubatic
tensor4 m_gen_r4_tensor; //!< The sum of various products of Kronecker deltas that is stored as a member
//!< for convenient reuse.

util::ManagedArray<float> m_particle_order_parameter; //!< The per-particle value of the order parameter.
util::ManagedArray<float>
std::shared_ptr<util::ManagedArray<float>> m_particle_order_parameter; //!< The per-particle value of the order parameter.
std::shared_ptr<util::ManagedArray<float>>
m_global_tensor; //!< The system-averaged homogeneous tensor encoding all particle orientations.
util::ManagedArray<float> m_cubatic_tensor; //!< The output tensor computed via simulated annealing.
std::shared_ptr<util::ManagedArray<float>> m_cubatic_tensor; //!< The output tensor computed via simulated annealing.

std::array<vec3<float>, 3>
m_system_vectors; //!< The global coordinate system, always use a simple Euclidean basis.
Expand Down

0 comments on commit 2cc36c2

Please sign in to comment.