Open Qmin  0.8.0
GPU-accelerated Q-tensor-based liquid crystal simulations
Functions | Variables
functions

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()
 

Detailed Description

Utility functions that can be called from host or device.

Function Documentation

◆ __attribute__()

template<typename T >
__attribute__ ( (always_inline)  ) &
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.

◆ resize() [1/4]

newData resize ( n 1)

◆ h1()

Initial value:
{
A mechanism for accessing data in GPUArray objects's.
Definition: gpuarray.h:91
data
Definition: functions.h:56
we just want to read
Definition: gpuarray.h:70
We want to access the data on the CPU.
Definition: gpuarray.h:47

Referenced by for().

◆ for()

for ( ) = h.data[i]

◆ resize() [2/4]

newData resize ( n-indices.  size())

◆ resize() [3/4]

newData resize ( n extraElements)

◆ hnew()

◆ swap()

data swap ( newData  )

◆ if()

if ( Nvector  ,
Narray   
)

◆ handle() [1/2]

◆ handle() [2/2]

◆ resize() [4/4]

copydata resize ( n  )

◆ dot() [1/3]

HOSTDEVICE scalar dot ( const dVec &  p1,
const dVec &  p2 
)

◆ idPow()

HOSTDEVICE int idPow ( int  i)

an integer to the dth power... the slow way

Referenced by hyperrectangularCellList::getCellNeighbors().

◆ dot() [2/3]

HOSTDEVICE int dot ( const iVec p1,
const iVec p2 
)

The dot product between d-Dimensional iVecs.

References iVec::x.

◆ dot() [3/3]

HOSTDEVICE scalar dot ( const scalar3 p1,
const scalar3 p2 
)

The dot product between scalar3's.

◆ norm() [1/2]

HOSTDEVICE scalar norm ( const scalar3 p)

◆ r3Distance()

HOSTDEVICE scalar r3Distance ( const scalar3 p1,
const scalar3 p2 
)

The dot product between scalar3's.

References norm(), and scalar3.

Referenced by pointSegmentDistance(), and truncatedPointSegmentDistance().

◆ cross()

HOSTDEVICE scalar3 cross ( const scalar3 p1,
scalar3 p2 
)

The norm of a scalar3's.

References scalar3.

Referenced by NISymmetricEigensolver3x3::Cross().

◆ norm() [2/2]

HOSTDEVICE scalar norm ( const dVec &  p)

The norm of a d-Dimensional vector.

References dot().

◆ pointSegmentDistance()

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().

◆ truncatedPointSegmentDistance()

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().

◆ wrap() [1/2]

HOSTDEVICE int wrap ( int  x,
int  m 
)

◆ wrap() [2/2]

HOSTDEVICE int3 wrap ( int3  x,
int3  m 
)

fit integers into non-negative domains

References wrap().

◆ ordered()

HOSTDEVICE bool ordered ( int  a,
int  b,
int  c 
)

◆ computeSign()

HOSTDEVICE int computeSign ( scalar  x)

compute the sign of a scalar, and return zero if x = 0

◆ computeSignNoCast()

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

◆ chooseGPU()

__host__ bool chooseGPU ( int  USE_GPU,
bool  verbose = false 
)
inline

Get basic stats about the chosen GPU (if it exists)

◆ getAvailableGPUs()

__host__ bool getAvailableGPUs ( vector< string > &  devices)
inline

Get basic stats about the chosen GPU (if it exists)

◆ qTensorFromDirector()

HOSTDEVICE void qTensorFromDirector ( scalar3  n,
scalar  S0,
dVec &  q 
)

◆ TrQ2()

HOSTDEVICE scalar TrQ2 ( dVec &  q)

◆ TrQ3()

HOSTDEVICE scalar TrQ3 ( dVec &  q)

◆ TrQ2Squared()

HOSTDEVICE scalar TrQ2Squared ( dVec &  q)

(Tr(Q^2))^2

References scalar, and TrQ2().

Referenced by landauDeGennesLC::computeEnergyCPU(), and gpu_energyPerSite_kernel().

◆ derivativeTrQ2()

HOSTDEVICE dVec derivativeTrQ2 ( dVec &  q)

◆ derivativeTrQ3()

HOSTDEVICE dVec derivativeTrQ3 ( dVec &  q)

◆ derivativeTrQ2Squared()

HOSTDEVICE dVec derivativeTrQ2Squared ( dVec &  q)

◆ allPhaseComponentForces()

HOSTDEVICE dVec allPhaseComponentForces ( dVec &  q,
scalar a,
scalar b,
scalar c 
)

Phase components combined into one for computational efficiency.

References scalar.

◆ QjkQki()

HOSTDEVICE dVec QjkQki ( dVec &  q)

Q_{jk}Q_{ki}.

◆ determinantOfQ()

HOSTDEVICE scalar determinantOfQ ( dVec &  q)

◆ eigFromVecs()

HOSTDEVICE scalar eigFromVecs ( vector< scalar > &  eVec,
scalar  ev0,
scalar  ev1,
scalar  ev2 
)

eVec is Q*e, ev0,ev1,ev2 are components ofe

References scalar.

◆ eigensystemOfQ()

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

◆ eigenvaluesOfQ()

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().

Variable Documentation

◆ index

int index
Initial value:
{
int n = data.getNumElements()
data
Definition: functions.h:56
int n
Definition: functions.h:64

Referenced by for(), getBufferInt3(), and multirankQTensorLatticeModel::getBufferInt3FromIndex().

◆ newData

GPUArray< T > newData

◆ idx

int idx = 0

◆ data

data = newData

◆ indices

vector<int> indices

◆ n

int n = data.getNumElements()

◆ vectorIndex

int vectorIndex = 0

◆ extraElements

int extraElements
Initial value:
{
int n = data.getNumElements()
data
Definition: functions.h:56
int n
Definition: functions.h:64

◆ copydata

vector< T > & copydata
Initial value:
{
int Narray = copydata.getNumElements()
GPUArray< T > & copydata
Definition: functions.h:110

◆ Nvector

int Nvector = data.size()