Exemple #1
0
Real SimBox::calcAtomDistSquared(int a1, int a2, Real** aCoords, Real* bSize) {
  Real dx = makePeriodic(aCoords[X_COORD][a2] - aCoords[X_COORD][a1], X_COORD, bSize);
  Real dy = makePeriodic(aCoords[Y_COORD][a2] - aCoords[Y_COORD][a1], Y_COORD, bSize);
  Real dz = makePeriodic(aCoords[Z_COORD][a2] - aCoords[Z_COORD][a1], Z_COORD, bSize);

  return dx * dx + dy * dy + dz * dz;
}
void Thread::runThread()
{
  char buffer[1024];
#if defined(_SYSTEM_WIN32_)
  icl_core::os::snprintf(buffer, 1023, "%s, %lu", getDescription().c_str(), threadId());
#elif defined(_SYSTEM_DARWIN_)
  icl_core::os::snprintf(buffer, 1023, "%s, %p", getDescription().c_str(), threadId().m_thread_id);
#else
  icl_core::os::snprintf(buffer, 1023, "%s, %lu", getDescription().c_str(), threadId().m_thread_id);
#endif
  m_thread_info = buffer;

  LOGGING_TRACE_CO(IclCoreThread, Thread, threadInfo(), "Begin." << endl);

  m_thread_mutex.lock();
  m_execute = true;
  m_starting = false;
  m_finished = false;

  // If this is actually a periodic thread, this call makes it periodic.
  // It this is a "normal" thread, this call does nothing.
  makePeriodic();

  // Call the run loop.
  run();

  m_execute = false;
  m_thread_mutex.unlock();
  m_finished = true;

  LOGGING_TRACE_CO(IclCoreThread, Thread, threadInfo(), "Done." << endl);
}