コード例 #1
0
ファイル: type.cpp プロジェクト: blackwarthog/synfig
		virtual void initialize_vfunc(Description &description)
		{
			Type::initialize_vfunc(description);
			description.name = "nil";
			description.local_name = local_n("nil");
			description.aliases.push_back("null");
			register_to_string(to_string);
		}
コード例 #2
0
  void InterpolationSurrogateBuilder<V,M>::build_values()
  {
    unsigned int n_begin, n_end;
    this->set_work_bounds( n_begin, n_end );

    // Cache each processors work, then we only need to do 1 Allgather
    std::vector<unsigned int> local_n(n_end-n_begin);

    // We need to cache (n_end-n_begin) values for each dataset,
    std::vector<std::vector<double> > local_values(this->m_data.size());
    for( std::vector<std::vector<double> >::iterator it = local_values.begin();
         it != local_values.end(); ++it )
      it->resize(n_end-n_begin);

    unsigned int count = 0;

    // vector to store current domain value
    V domain_vector(this->get_default_data().get_paramDomain().vectorSpace().zeroVector());

    // vector to store values evaluated at the current domain_vector
    std::vector<double> values(this->m_data.size());

    for( unsigned int n = n_begin; n < n_end; n++ )
      {
        this->set_domain_vector( n, domain_vector );

        this->evaluate_model( domain_vector, values );

        local_n[count] = n;

        for( unsigned int s = 0; s < this->m_data.size(); s++ )
          local_values[s][count] = values[s];

        count += 1;
      }

    /* Sync all the locally computed values between the subenvironments
       so all processes have all the computed values. We need to sync
       values for every data set. */
    for( unsigned int s = 0; s < this->m_data.size(); s++ )
      this->sync_data( local_n, local_values[s], this->m_data.get_dataset(s) );
  }