Open Qmin
0.8.0
GPU-accelerated Q-tensor-based liquid crystal simulations
|
Utility functions that can be called from host or device. More...
Functions | |
template<typename T > | |
__attribute__ ((always_inline)) void removeDuplicateVectorElements(vector< T > &data) | |
remove duplicate elements from a vector, preserving the order, using sets More... | |
newData | resize (n-1) |
ArrayHandle< T > | h1 (newData, access_location::host, access_mode::overwrite) |
for (int i=0;i< n;++i) = h.data[i] | |
newData | resize (n-indices.size()) |
newData | resize (n+extraElements) |
ArrayHandle< T > | hnew (newData, access_location::host, access_mode::overwrite) |
data | swap (newData) |
if (Nvector > Narray) copydata.resize(Nvector) | |
ArrayHandle< T > | handle (copydata, access_location::host, access_mode::overwrite) |
ArrayHandle< T > | handle (data, access_location::host, access_mode::read) |
copydata | resize (n) |
HOSTDEVICE scalar | dot (const dVec &p1, const dVec &p2) |
The dot product between d-Dimensional vectors. More... | |
HOSTDEVICE int | idPow (int i) |
an integer to the dth power... the slow way More... | |
HOSTDEVICE int | dot (const iVec &p1, const iVec &p2) |
The dot product between d-Dimensional iVecs. More... | |
HOSTDEVICE scalar | dot (const scalar3 &p1, const scalar3 &p2) |
The dot product between scalar3's. More... | |
HOSTDEVICE scalar | norm (const scalar3 &p) |
The norm of a scalar3's. More... | |
HOSTDEVICE scalar | r3Distance (const scalar3 &p1, const scalar3 &p2) |
The dot product between scalar3's. More... | |
HOSTDEVICE scalar3 | cross (const scalar3 &p1, scalar3 &p2) |
The norm of a scalar3's. More... | |
HOSTDEVICE scalar | norm (const dVec &p) |
The norm of a d-Dimensional vector. More... | |
HOSTDEVICE scalar | pointSegmentDistance (const scalar3 &p, const scalar3 &s1, const scalar3 &s2, scalar3 &dir) |
point-segment distance in 3D More... | |
HOSTDEVICE scalar | truncatedPointSegmentDistance (const scalar3 &p, const scalar3 &s1, const scalar3 &s2, scalar3 &dir) |
point-segment distance in 3D More... | |
HOSTDEVICE int | wrap (int x, int m) |
fit integers into non-negative domains More... | |
HOSTDEVICE int3 | wrap (int3 x, int3 m) |
fit integers into non-negative domains More... | |
HOSTDEVICE bool | ordered (int a, int b, int c) |
HOSTDEVICE int | computeSign (scalar x) |
compute the sign of a scalar, and return zero if x = 0 More... | |
HOSTDEVICE scalar | computeSignNoCast (scalar x) |
compute the sign of a scalar, and return zero if x = 0...but return a scalar to avoid expensive casts on the GPU More... | |
__host__ bool | chooseGPU (int USE_GPU, bool verbose=false) |
Get basic stats about the chosen GPU (if it exists) More... | |
__host__ bool | getAvailableGPUs (vector< string > &devices) |
Get basic stats about the chosen GPU (if it exists) More... | |
HOSTDEVICE void | qTensorFromDirector (scalar3 n, scalar S0, dVec &q) |
return a qtensor given a director and a value of S0 More... | |
HOSTDEVICE scalar | TrQ2 (dVec &q) |
Tr(Q^2) = Q_{kl}Q_{lk}. More... | |
HOSTDEVICE scalar | TrQ3 (dVec &q) |
Tr(Q^3) More... | |
HOSTDEVICE scalar | TrQ2Squared (dVec &q) |
(Tr(Q^2))^2 More... | |
HOSTDEVICE dVec | derivativeTrQ2 (dVec &q) |
derivative of Tr(Q^2) w/r/t q[0] .. q[4] More... | |
HOSTDEVICE dVec | derivativeTrQ3 (dVec &q) |
derivative of Tr(Q^3) w/r/t q[0] .. q[4] More... | |
HOSTDEVICE dVec | derivativeTrQ2Squared (dVec &q) |
derivative of (Tr(Q^2))^2 w/r/t q[0] .. q[4] More... | |
HOSTDEVICE dVec | allPhaseComponentForces (dVec &q, scalar &a, scalar &b, scalar &c) |
Phase components combined into one for computational efficiency. More... | |
HOSTDEVICE dVec | QjkQki (dVec &q) |
Q_{jk}Q_{ki}. More... | |
HOSTDEVICE scalar | determinantOfQ (dVec &q) |
determinant of a qt matrix More... | |
HOSTDEVICE scalar | eigFromVecs (vector< scalar > &eVec, scalar ev0, scalar ev1, scalar ev2) |
eVec is Q*e, ev0,ev1,ev2 are components ofe More... | |
HOSTDEVICE void | eigensystemOfQ (dVec &q, vector< scalar > &eVals, vector< scalar > &eVec1, vector< scalar > &eVec2, vector< scalar > &eVec3) |
get the eigensystem associated with a Q tensor More... | |
HOSTDEVICE void | eigenvaluesOfQ (dVec &q, scalar &a, scalar &b, scalar &c) |
Get the eigenvalues of a real symmetric traceless 3x3 matrix. More... | |
Variables | |
int | index |
GPUArray< T > | newData |
int | idx = 0 |
data = newData | |
vector< int > | indices |
int | n = data.getNumElements() |
int | vectorIndex = 0 |
int | extraElements |
GPUArray< T > & | copydata |
int | Nvector = data.size() |
Utility functions that can be called from host or device.
|
inline |
remove duplicate elements from a vector, preserving the order, using sets
copy a GPUarray to a vector
fill the first data.size() elements of a GPU array with elements of the data vector
grow a GPUArray, leaving the current elements the same but with extra capacity at the end of the array
shrink a GPUArray by removing the elements [i1,i2,...in] of a vector and shifting any elements j > i_i into place
shrink a GPUArray by removing the i'th element and shifting any elements j > i into place
References data.
Referenced by kernelTuner::kernelTuner().
ArrayHandle< T > h1 | ( | newData | , |
access_location::host | , | ||
access_mode::overwrite | |||
) |
Referenced by for().
for | ( | ) | = h.data[i] |
References ArrayHandle< T >::data, h1(), idx, and index.
Referenced by Simulation::computePressureTensor().
ArrayHandle<T> hnew | ( | newData | , |
access_location::host | , | ||
access_mode::overwrite | |||
) |
Referenced by GPUArray< curandState >::swap().
if | ( | Nvector | , |
Narray | |||
) |
ArrayHandle<T> handle | ( | copydata | , |
access_location::host | , | ||
access_mode::overwrite | |||
) |
ArrayHandle<T> handle | ( | data | , |
access_location::host | , | ||
access_mode::read | |||
) |
HOSTDEVICE scalar dot | ( | const dVec & | p1, |
const dVec & | p2 | ||
) |
The dot product between d-Dimensional vectors.
References scalar.
Referenced by energyMinimizerAdam::adamStepCPU(), baseLatticeForce::computeEnergyCPU(), simpleModel::computeInstantaneousTemperature(), simpleModel::computeKineticEnergy(), NISymmetricEigensolver3x3::Dot(), energyMinimizerFIRE::fireStepCPU(), gpu_compute_neighbor_list_kernel(), gpu_compute_neighbor_list_TPC_kernel(), gpu_compute_neighbor_list_TPP_kernel(), gpu_dot_dVec_vectors_kernel(), gpu_dVec_dot_products_kernel(), gpu_scalar_times_dVec_squared_kernel(), gpu_set_random_spins_kernel(), gpu_vec_dot_product_kernel(), energyMinimizerGradientDescent::gradientDescentCPU(), energyMinimizerNesterovAG::nesterovStepCPU(), norm(), IndexDD::operator()(), pointSegmentDistance(), poissonDiskSampling::sample_annulus_point(), cubicLattice::setSpinsRandomly(), simpleModel::setVelocitiesMaxwellBoltzmann(), and truncatedPointSegmentDistance().
HOSTDEVICE int idPow | ( | int | i | ) |
an integer to the dth power... the slow way
Referenced by hyperrectangularCellList::getCellNeighbors().
HOSTDEVICE int dot | ( | const iVec & | p1, |
const iVec & | p2 | ||
) |
The dot product between d-Dimensional iVecs.
References iVec::x.
HOSTDEVICE scalar dot | ( | const scalar3 & | p1, |
const scalar3 & | p2 | ||
) |
The dot product between scalar3's.
HOSTDEVICE scalar norm | ( | const scalar3 & | p | ) |
The norm of a scalar3's.
References dot().
Referenced by neighborList::computeCPU(), multirankSimulation::createCylindricalObject(), qTensorLatticeModel::createSimpleSpherialColloid(), multirankSimulation::createSphericalCavity(), multirankSimulation::createSphericalColloid(), multirankSimulation::createSpherocylinder(), gpu_update_spins_kernel(), cubicLattice::moveParticles(), NISymmetricEigensolver3x3::operator()(), poissonDiskSampling::poissonDiskSampling(), r3Distance(), and multirankSimulation::setDipolarField().
HOSTDEVICE scalar r3Distance | ( | const scalar3 & | p1, |
const scalar3 & | p2 | ||
) |
The dot product between scalar3's.
References norm(), and scalar3.
Referenced by pointSegmentDistance(), and truncatedPointSegmentDistance().
HOSTDEVICE scalar3 cross | ( | const scalar3 & | p1, |
scalar3 & | p2 | ||
) |
HOSTDEVICE scalar norm | ( | const dVec & | p | ) |
The norm of a d-Dimensional vector.
References dot().
HOSTDEVICE scalar pointSegmentDistance | ( | const scalar3 & | p, |
const scalar3 & | s1, | ||
const scalar3 & | s2, | ||
scalar3 & | dir | ||
) |
point-segment distance in 3D
References dot(), r3Distance(), scalar, and scalar3.
Referenced by multirankSimulation::createSpherocylinder().
HOSTDEVICE scalar truncatedPointSegmentDistance | ( | const scalar3 & | p, |
const scalar3 & | s1, | ||
const scalar3 & | s2, | ||
scalar3 & | dir | ||
) |
point-segment distance in 3D
References dot(), r3Distance(), scalar, and scalar3.
Referenced by multirankSimulation::createCylindricalObject().
HOSTDEVICE int wrap | ( | int | x, |
int | m | ||
) |
fit integers into non-negative domains
Referenced by qTensorLatticeModel::createBoundaryFromFile(), multirankSimulation::createMultirankBoundaryObject(), qTensorLatticeModel::createSimpleSpherialColloid(), cubicLattice::getNeighbors(), gpu_get_six_neighbors(), gpu_lattice_spin_force_nn_kernel(), and wrap().
HOSTDEVICE int3 wrap | ( | int3 | x, |
int3 | m | ||
) |
fit integers into non-negative domains
References wrap().
HOSTDEVICE bool ordered | ( | int | a, |
int | b, | ||
int | c | ||
) |
Referenced by multirankQTensorLatticeModel::positionToIndex().
HOSTDEVICE int computeSign | ( | scalar | x | ) |
compute the sign of a scalar, and return zero if x = 0
HOSTDEVICE scalar computeSignNoCast | ( | scalar | x | ) |
compute the sign of a scalar, and return zero if x = 0...but return a scalar to avoid expensive casts on the GPU
|
inline |
Get basic stats about the chosen GPU (if it exists)
|
inline |
Get basic stats about the chosen GPU (if it exists)
HOSTDEVICE void qTensorFromDirector | ( | scalar3 | n, |
scalar | S0, | ||
dVec & | q | ||
) |
return a qtensor given a director and a value of S0
Referenced by multirankSimulation::createCylindricalObject(), qTensorLatticeModel::createSimpleSpherialColloid(), multirankSimulation::createSphericalCavity(), multirankSimulation::createSphericalColloid(), multirankSimulation::createSpherocylinder(), gpu_set_random_nematic_qTensors_kernel(), multirankSimulation::setDipolarField(), and qTensorLatticeModel::setNematicQTensorRandomly().
HOSTDEVICE scalar TrQ2 | ( | dVec & | q | ) |
Tr(Q^2) = Q_{kl}Q_{lk}.
Referenced by computeBoundaryEnergy(), qTensorLatticeModel::computeDefectMeasures(), landauDeGennesLC::computeEnergyCPU(), gpu_degenerateEigenvalue_kernel(), gpu_energyPerSite_kernel(), and TrQ2Squared().
HOSTDEVICE scalar TrQ3 | ( | dVec & | q | ) |
Tr(Q^3)
Referenced by landauDeGennesLC::computeEnergyCPU(), and gpu_energyPerSite_kernel().
HOSTDEVICE scalar TrQ2Squared | ( | dVec & | q | ) |
(Tr(Q^2))^2
References scalar, and TrQ2().
Referenced by landauDeGennesLC::computeEnergyCPU(), and gpu_energyPerSite_kernel().
HOSTDEVICE dVec derivativeTrQ2 | ( | dVec & | q | ) |
derivative of Tr(Q^2) w/r/t q[0] .. q[4]
derivative of Tr(Q^2) w/r/t q[0] .. q[5]
Referenced by landauDeGennesLC::computeAllDistortionTermsBoundaryCPU(), landauDeGennesLC::computeAllDistortionTermsBulkCPU(), landauDeGennesLC::computeL1BoundaryCPU(), landauDeGennesLC::computeL1BulkCPU(), and gpu_phase_force().
HOSTDEVICE dVec derivativeTrQ3 | ( | dVec & | q | ) |
derivative of Tr(Q^3) w/r/t q[0] .. q[4]
derivative of Tr(Q^3) w/r/t q[0] .. q[5]
Referenced by landauDeGennesLC::computeAllDistortionTermsBoundaryCPU(), landauDeGennesLC::computeAllDistortionTermsBulkCPU(), landauDeGennesLC::computeL1BoundaryCPU(), landauDeGennesLC::computeL1BulkCPU(), and gpu_phase_force().
HOSTDEVICE dVec derivativeTrQ2Squared | ( | dVec & | q | ) |
derivative of (Tr(Q^2))^2 w/r/t q[0] .. q[4]
References scalar.
Referenced by landauDeGennesLC::computeAllDistortionTermsBoundaryCPU(), landauDeGennesLC::computeAllDistortionTermsBulkCPU(), landauDeGennesLC::computeL1BoundaryCPU(), landauDeGennesLC::computeL1BulkCPU(), and gpu_phase_force().
HOSTDEVICE dVec allPhaseComponentForces | ( | dVec & | q, |
scalar & | a, | ||
scalar & | b, | ||
scalar & | c | ||
) |
Phase components combined into one for computational efficiency.
References scalar.
HOSTDEVICE dVec QjkQki | ( | dVec & | q | ) |
Q_{jk}Q_{ki}.
HOSTDEVICE scalar determinantOfQ | ( | dVec & | q | ) |
determinant of a qt matrix
Referenced by qTensorLatticeModel::computeDefectMeasures(), eigenvaluesOfQ(), gpu_computeDeterminant_kernel(), and gpu_degenerateEigenvalue_kernel().
eVec is Q*e, ev0,ev1,ev2 are components ofe
References scalar.
HOSTDEVICE void eigensystemOfQ | ( | dVec & | q, |
vector< scalar > & | eVals, | ||
vector< scalar > & | eVec1, | ||
vector< scalar > & | eVec2, | ||
vector< scalar > & | eVec3 | ||
) |
get the eigensystem associated with a Q tensor
HOSTDEVICE void eigenvaluesOfQ | ( | dVec & | q, |
scalar & | a, | ||
scalar & | b, | ||
scalar & | c | ||
) |
Get the eigenvalues of a real symmetric traceless 3x3 matrix.
References determinantOfQ(), PI, and scalar.
Referenced by qTensorLatticeModel::computeDefectMeasures(), qTensorLatticeModel::getAverageEigenvalues(), and gpu_largestEigenvalue_kernel().
int index |
Referenced by for(), getBufferInt3(), and multirankQTensorLatticeModel::getBufferInt3FromIndex().
GPUArray< T > newData |
int idx = 0 |
Referenced by landauDeGennesLC::computeFirstDerivatives(), cubicLattice::cubicLattice(), for(), getBufferInt3(), multirankQTensorLatticeModel::getBufferInt3FromIndex(), gpu_adam_step_kernel(), gpu_compute_cell_list_kernel(), gpu_compute_neighbor_list_kernel(), gpu_computeDeterminant_kernel(), gpu_copy_boundary_object_kernel(), gpu_copy_gpuarray_kernel(), gpu_copyReceivingBuffer_kernel(), gpu_degenerateEigenvalue_kernel(), gpu_displacement_vv_kernel(), gpu_dot_dVec_vectors_kernel(), gpu_dVec_plusEqual_dVec_kernel(), gpu_dVec_times_scalar_kernel(), gpu_energyPerSite_kernel(), gpu_largestEigenvalue_kernel(), gpu_lattice_spin_force_nn_kernel(), gpu_move_boundary_object_kernel(), gpu_move_particles_kernel(), gpu_nesterovAG_step_kernel(), gpu_prepareSendingBuffer_kernel(), gpu_qTensor_computeBoundaryForcesGPU_kernel(), gpu_qTensor_computeObjectForceFromStresses_kernel(), gpu_qTensor_multiConstantForce_kernel(), gpu_qTensor_oneConstantForce_kernel(), gpu_qTensor_uniformFieldForcekernel(), gpu_scalar_times_dVec_squared_kernel(), gpu_set_array_kernel(), gpu_set_random_nematic_qTensors_kernel(), gpu_set_random_spins_kernel(), gpu_update_qTensor_simple_kernel(), gpu_update_spins_kernel(), gpu_update_spins_simple_kernel(), gpu_update_velocity_FIRE_kernel(), gpu_update_velocity_kernel(), gpu_vec_dot_product_kernel(), gpu_vec_dot_product_unrolled_kernel(), multirankQTensorLatticeModel::indexToPosition(), initialize_RNG_array_kernel(), and multirankSimulation::saveState().
data = newData |
Referenced by __attribute__(), and multirankSimulation::sumUpdaterData().
vector<int> indices |
int n = data.getNumElements() |
Referenced by landauDeGennesLC::computeStressTensors(), qTensorLatticeModel::getAverageEigenvalues(), getNumBlocksAndThreads(), gpu_dot_dVec_vectors_kernel(), gpu_dVec_plusEqual_dVec_kernel(), gpu_dVec_times_scalar_kernel(), gpu_scalar_times_dVec_squared_kernel(), gpu_set_random_nematic_qTensors_kernel(), gpuReduction(), simpleModel::initializeSimpleModel(), reduce6(), qTensorLatticeModel::setNematicQTensorRandomly(), force::setNThreads(), updater::setNThreads(), Simulation::setNThreads(), simpleModel::setNThreads(), and simpleModel::simpleModel().
int vectorIndex = 0 |
int extraElements |
vector< T > & copydata |
int Nvector = data.size() |