Beispiel #1
0
		virtual void run(int threads)
        {
            m_sink.m_total=0;
			m_source.m_message_count = m_sink.m_message_count=0;
			m_source(&m_sink, m_messages);
			active::run s(threads);
		}
Beispiel #2
0
 const typename KeyValueCache<KeyType, ValueType, MutexType>::Value&
     KeyValueCache<KeyType, ValueType, MutexType>::Load(const Key& key) {
   return m_cache.GetOrInsert(key,
     [&] {
       return m_source(key);
     });
 }
Beispiel #3
0
void 
Quadratic<EvalT,Traits>::
evaluateFields(typename Traits::EvalData workset){

  // Loop over cells, quad points: compute Quadratic Source Term
  if (m_constant) {
    for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
      for (std::size_t iqp=0; iqp<m_num_qp; iqp++)
        m_source(cell, iqp) = m_factor;
    }
  } 
  else {
    for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
      for (std::size_t iqp=0; iqp<m_num_qp; iqp++)
        m_source(cell, iqp) = 
	  m_factor * m_baseField(cell,iqp) * m_baseField(cell,iqp);
    }
  }
}
Beispiel #4
0
void 
Constant<EvalT,Traits>::
evaluateFields(typename Traits::EvalData workset){

  // Loop over cells, quad points: compute Constant Source Term
  for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
    for (std::size_t iqp=0; iqp<m_num_qp; iqp++)
      m_source(cell, iqp) = m_constant;
  }
}
Beispiel #5
0
void 
Trigonometric<EvalT,Traits>::
evaluateFields(typename Traits::EvalData workset){

  // Loop over cells, quad points: compute Trigonometric Source Term
  if (m_num_dim == 2) {
    for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
      for (std::size_t iqp=0; iqp<m_num_qp; iqp++) {
        //MeshScalarT *X = &coordVec(cell,iqp,0); 
        m_source(cell, iqp) = 8.0*pi*pi*sin(2.0*pi*coordVec(cell,iqp,0))*cos(2.0*pi*coordVec(cell,iqp,1));
      }
    }
  }
  else {
    std::cout << "Trigonometric source implemented only for 2D; setting f = 1 constant source." << std::endl; 
    for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
      for (std::size_t iqp=0; iqp<m_num_qp; iqp++) {
        m_source(cell, iqp) = m_constant;
      }
    }
  }
}
Beispiel #6
0
void MVExponential<EvalT,Traits>::evaluateFields(typename Traits::EvalData workset){

  ScalarT a = 0.0;
  for (unsigned int j=0; j<m_factor.size(); j++) {
    a += m_factor[j];
  }
  a /= static_cast<double>(m_factor.size());

  // Loop over cells, quad points: compute MVExponential Source Term
  for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
    for (std::size_t iqp=0; iqp<m_num_qp; iqp++)
      m_source(cell, iqp) = a*std::exp(m_baseField(cell,iqp));
  }
}
Beispiel #7
0
void 
TruncatedKL<EvalT,Traits>::
evaluateFields(typename Traits::EvalData workset){

  // Loop over cells, quad points: compute TruncatedKL Source Term
  for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
    for (std::size_t qp=0; qp<m_num_qp; qp++) {
      for (std::size_t i=0; i<m_num_dims; i++)
	m_point[i] = 
	  Sacado::ScalarValue<MeshScalarT>::eval(m_coordVec(cell,qp,i));
        m_source(cell, qp) = m_exp_rf_kl->evaluate(m_point, m_rv);
    }
  }
}
Beispiel #8
0
void 
Table<EvalT,Traits>::
evaluateFields(typename Traits::EvalData workset){

  if(workset.current_time <= 0.0) // if time is uninitialized or zero, just take first value

    m_constant = sourceval[0];

  else { // Interpolate between time values

    bool found_it = false;

    for(int i = 0; i < num_time_vals - 1; i++) // Stride through time

      if(workset.current_time >= time[i] && workset.current_time <= time[i + 1] ){ // Have bracketed current time

        double s = (workset.current_time - time[i]) / (time[i + 1] - time[i]); // 0 \leq s \leq 1

        m_constant = sourceval[i] + s * (sourceval[i + 1] - sourceval[i]); // interp value corresponding to s

        found_it = true;

        break;

      }

    TEUCHOS_TEST_FOR_EXCEPTION(!found_it, Teuchos::Exceptions::InvalidParameter, std::endl <<
		     "Error! Cannot locate the current time \"" << workset.current_time 
		     << "\" in the time series data between the endpoints " << time[0]
          << " and " << time[num_time_vals - 1] << "." << std::endl);
  }

  // Loop over cells, quad points: compute Table Source Term
  for (std::size_t cell = 0; cell < workset.numCells; ++cell) {
    for (std::size_t iqp=0; iqp<m_num_qp; iqp++)
      m_source(cell, iqp) = m_constant;
  }
}
Beispiel #9
0
  virtual void evaluateFields (typename Traits::EvalData workset) {
    for (std::size_t cell = 0; cell < workset.numCells; ++cell)
      for (std::size_t iqp=0; iqp<m_num_qp; iqp++)
        m_source(cell, iqp) = 
	  m_phi(cell,iqp) * m_sigma_f(cell,iqp) * m_E_f(cell,iqp);
  }