当前位置: 首页>>代码示例>>C++>>正文


C++ domain函数代码示例

本文整理汇总了C++中domain函数的典型用法代码示例。如果您正苦于以下问题:C++ domain函数的具体用法?C++ domain怎么用?C++ domain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了domain函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PaStiX

        PaStiX(
                MPI_Comm mpi_comm,
                int n_local_rows,
                const PRng &p_ptr,
                const CRng &p_col,
                const VRng &p_val,
                const params& = params()
                )
            : comm(mpi_comm), nrows(n_local_rows), pastix_data(0),
              ptr(boost::begin(p_ptr), boost::end(p_ptr)),
              col(boost::begin(p_col), boost::end(p_col)),
              val(boost::begin(p_val), boost::end(p_val)),
              row(nrows), perm(nrows)
        {
            std::vector<int> domain(comm.size + 1, 0);
            MPI_Allgather(&nrows, 1, MPI_INT, &domain[1], 1, MPI_INT, comm);
            boost::partial_sum(domain, domain.begin());

            boost::copy(
                    boost::irange(domain[comm.rank], domain[comm.rank + 1]),
                    row.begin()
                    );

            // PaStiX needs 1-based matrices:
            BOOST_FOREACH(pastix_int_t &p, ptr) ++p;
            BOOST_FOREACH(pastix_int_t &c, col) ++c;
            BOOST_FOREACH(pastix_int_t &r, row) ++r;

            // Initialize parameters with default values:
            iparm[IPARM_MODIFY_PARAMETER] = API_NO;
            call_pastix(API_TASK_INIT, API_TASK_INIT);

            // Factorize the matrix.
            iparm[IPARM_VERBOSE        ] = API_VERBOSE_NOT;
            iparm[IPARM_RHS_MAKING     ] = API_RHS_B;
            iparm[IPARM_SYM            ] = API_SYM_NO;
            iparm[IPARM_FACTORIZATION  ] = API_FACT_LU;
            iparm[IPARM_TRANSPOSE_SOLVE] = API_YES;
#ifdef _OPENMP
            iparm[IPARM_THREAD_NBR]      = omp_get_max_threads();
#endif
            call_pastix(API_TASK_ORDERING, API_TASK_NUMFACT);
        }
开发者ID:huahbo,项目名称:amgcl,代码行数:43,代码来源:pastix.hpp

示例2: OneDim

Sim1D::Sim1D(vector<Domain1D*>& domains) :
    OneDim(domains)
{
    // resize the internal solution vector and the work array, and perform
    // domain-specific initialization of the solution vector.

    m_x.resize(size(), 0.0);
    m_xnew.resize(size(), 0.0);
    for (size_t n = 0; n < m_nd; n++) {
        domain(n)._getInitialSoln(DATA_PTR(m_x) + start(n));
    }

    // set some defaults
    m_tstep = 1.0e-5;
    m_steps.push_back(1);
    m_steps.push_back(2);
    m_steps.push_back(5);
    m_steps.push_back(10);
}
开发者ID:enochd,项目名称:cantera,代码行数:19,代码来源:Sim1D.cpp

示例3: prob

  /** 
   * Return a LP for the specified mesh. This function implements the
   * prob() pure virtual function of class LPTestBase.
   */
  LinearProblem prob(const Mesh& mesh) const
    {
      const double pi = 4.0*atan(1.0);
      CellFilter left = domain().left();

      Expr u = new UnknownFunction(new Lagrange(2), "u");
      Expr v = new TestFunction(new Lagrange(2), "v");
      Expr dx = gradient(1);
      Expr x = coord(0);

      QuadratureFamily quad = new GaussianQuadrature(4);

      Expr eqn = Integral(interior(), (dx*v)*(dx*u), quad)
        + Integral(interior(), -0.25*pi*pi*sin(pi*x/2.0)*v, quad);

      Expr bc = EssentialBC(left, v*u, quad);
      
      return LinearProblem(mesh, eqn, bc, v, u, vecType());
    }
开发者ID:cakeisalie,项目名称:oomphlib_003,代码行数:23,代码来源:LPTests1D.cpp

示例4: main

void main( int argc, char ** argv )
{
   Environment env(argc, argv);
   WALBERLA_UNUSED(env);
   walberla::mpi::MPIManager::instance()->useWorldComm();

   //init domain partitioning
   auto forest = blockforest::createBlockForest( AABB(0,0,0,20,20,20), // simulation domain
                                                 Vector3<uint_t>(2,2,2), // blocks in each direction
                                                 Vector3<bool>(false, false, false) // periodicity
                                                 );
   domain::BlockForestDomain domain(forest);

   //init data structures
   data::ParticleStorage ps(100);

   //initialize particle
   auto uid = createSphere(ps, domain);
   WALBERLA_LOG_DEVEL_ON_ROOT("uid: " << uid);

   //init kernels
   mpi::ReduceProperty    RP;
   mpi::SyncNextNeighbors SNN;

   //sync
   SNN(ps, domain);

   auto pIt = ps.find(uid);
   if (pIt != ps.end())
   {
      pIt->getForceRef() += Vec3(real_c(walberla::mpi::MPIManager::instance()->rank()));
   }

   RP.operator()<ForceTorqueNotification>(ps);

   if (walberla::mpi::MPIManager::instance()->rank() == 0)
   {
      WALBERLA_CHECK_FLOAT_EQUAL( pIt->getForce(), Vec3(real_t(28)) );
   } else
   {
      WALBERLA_CHECK_FLOAT_EQUAL( pIt->getForce(), Vec3(real_t(walberla::mpi::MPIManager::instance()->rank())) );
   }
}
开发者ID:lssfau,项目名称:walberla,代码行数:43,代码来源:ReduceProperty.cpp

示例5: image

  void image() const
  {
    typedef CGAL::Image_3 Image;
    typedef CGAL::Labeled_image_mesh_domain_3<Image, K_e_i> Mesh_domain;

    typedef typename CGAL::Mesh_triangulation_3<
      Mesh_domain,
      CGAL::Kernel_traits<Mesh_domain>::Kernel,
      Concurrency_tag>::type Tr;
    typedef CGAL::Mesh_complex_3_in_triangulation_3<Tr> C3t3;

    typedef CGAL::Mesh_criteria_3<Tr> Mesh_criteria;
    typedef typename Mesh_criteria::Facet_criteria Facet_criteria;
    typedef typename Mesh_criteria::Cell_criteria Cell_criteria;

    //-------------------------------------------------------
    // Data generation
    //-------------------------------------------------------
    Image image;
    image.read("data/liver.inr.gz");

    std::cout << "\tSeed is\t"
      << CGAL::get_default_random().get_seed() << std::endl;
    Mesh_domain domain(image, 1e-9, &CGAL::get_default_random());

    // Set mesh criteria
    Facet_criteria facet_criteria(25, 20*image.vx(), 5*image.vx());
    Cell_criteria cell_criteria(4, 25*image.vx());
    Mesh_criteria criteria(facet_criteria, cell_criteria);

    // Mesh generation
    C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria,
                                        CGAL::parameters::no_exude(),
                                        CGAL::parameters::no_perturb());

    // Verify
    this->verify_c3t3_volume(c3t3, 1772330*0.95, 1772330*1.05);
    this->verify(c3t3,domain,criteria, Bissection_tag());

    typedef typename Mesh_domain::Surface_patch_index Patch_id;
    CGAL_static_assertion(CGAL::Output_rep<Patch_id>::is_specialized);
    CGAL_USE_TYPE(Patch_id);
  }
开发者ID:lrineau,项目名称:cgal,代码行数:43,代码来源:test_meshing_3D_image_deprecated.cpp

示例6: domain

std::string IPeakFunction::getCentreParameterName() const {
  FunctionParameterDecorator_sptr fn =
      boost::dynamic_pointer_cast<FunctionParameterDecorator>(
          FunctionFactory::Instance().createFunction("PeakParameterFunction"));

  if (!fn) {
    throw std::runtime_error(
        "PeakParameterFunction could not be created successfully.");
  }

  fn->setDecoratedFunction(this->name());

  FunctionDomain1DVector domain(std::vector<double>(4, 0.0));
  TempJacobian jacobian(4, fn->nParams());

  fn->functionDeriv(domain, jacobian);

  return parameterName(jacobian.maxParam(0));
}
开发者ID:liyulun,项目名称:mantid,代码行数:19,代码来源:IPeakFunction.cpp

示例7: launchNewton

int launchNewton(){
    std::cout << "Launch Newton" << std::endl;

    char** argv = NULL;
    GLUTWindowManagers::init(0, argv);

    int w = 800;
    int h = 800;

    DomaineMaths domain(-w / 2, - h / 2, w, h);

    NewtonImageSequential* functionalImage = new NewtonImageSequential(w, h, domain);
    FractaleGLImage* functionSelections = new FractaleGLImage(functionalImage);

    GLUTWindowManagers* windowManager = GLUTWindowManagers::getInstance();
    windowManager->createWindow(functionSelections);
    windowManager->runALL(); //This call is blocking

    return 0;
}
开发者ID:mse-gpu,项目名称:Newton,代码行数:20,代码来源:main.cpp

示例8: domain

 void
 ArccosineExpression::evaluateImpl(
     const MatrixID<const Interval>& parameterID,
     const MatrixID<Interval>& resultID,
     ExpressionCompiler<Interval>& expressionCompiler
 ) const {
     expressionCompiler.evaluate(operand(), parameterID, resultID);
     expressionCompiler.compute(
         resultID,
         [] (IntervalMatrixViewXd results) {
             results.setMap(
                 results,
                 [] (Interval value) {
                     Interval domain(-1, 1);
                     return opensolid::acos(value.intersection(domain));
                 }
             );
         }
     );
 }
开发者ID:ianmackenzie,项目名称:cpp-opensolid-core,代码行数:20,代码来源:ArccosineExpression.cpp

示例9: form

/*! We pass the global maximum as a parameter to ensure the containment of the
density form of the original Levy target as an "energy" function inside the
number screen.  We get the density from energy by exponentiating its negative.  
This allows ease of likelihood inference and can be circumvented in several 
ways.  For eg we can find the global min first for the Levy target energy and 
then use it as the global max parameter GlbMx to the density form (actually the
shape without the normalizing constant).  Here we have already computed the 
Global max parameter GlbMx using C-XSC Toolbox.
*/
FLevy2D::FLevy2D (real T, real GlbMx, real C1, real C2, 
                  real DomainLimit, bool LogPi)
:
Temperature (T), GlobalMax (GlbMx), Center1 (C1), Center2 (C2)
{
  setUsingLogDensity (LogPi);

  PriorType = 0;// Uniform PriorType is an inherited member from Fobj
  // set up the domain list
  ivector domain (1, 2);
  LabBox  Ldomain;
  for (int i = 1; i <= 2; i++)
  {
    domain[i] = interval (-DomainLimit, DomainLimit);
  }
  Ldomain.Box = domain;
  Ldomain.L = 0;
  LabDomainList.push_back (Ldomain);

}
开发者ID:raazesh-sainudiin,项目名称:mrs2,代码行数:29,代码来源:FLevy2D.cpp

示例10: Data

FLevy2D_Lkl_Tfrom1data::FLevy2D_Lkl_Tfrom1data (ivector & data, 
                                                real GlbMx, real C1, real C2, 
                                                interval DomainLimit, 
                                                bool LogPi)
:
Data (data), GlobalMax (GlbMx), Center1 (C1), Center2 (C2)
{
  setUsingLogDensity (LogPi);
  //PriorType = 0;// Uniform PriorType is an inherited member from Fobj
  //domain for the temperature parameter in the likelihood
  ivector domain (1, 1);
  LabBox Ldomain;
  for (int i = 1; i <= 1; i++)
  {
    domain[i] = DomainLimit;
  }
  Ldomain.Box = domain;
  Ldomain.L = 0;
  LabDomainList.push_back (Ldomain);

}
开发者ID:raazesh-sainudiin,项目名称:mrs2,代码行数:21,代码来源:FLevy2D.cpp

示例11: benchSequential

inline void benchSequential(rgba* image){
    DomaineMaths domain(0, 0, DIM_W, DIM_H);

    float dx = (float) (domain.dx / (float) DIM_W);
    float dy = (float) (domain.dy / (float) DIM_H);
    float y = domain.y0;

    for(int i = 1; i <= DIM_W; ++i){
	float x = domain.x0;

	for(int j = 1; j <= DIM_H; ++j){
	    float c = perlinNoise(x,y, 1);

	    setFloatRGBA(image, i, j, 135, 206, 250, c * 255.0);

	    x += dx;
	}

	y += dy;
    }
}
开发者ID:mse-gpu,项目名称:PerlinTexture,代码行数:21,代码来源:main.cpp

示例12: x_GetAccountNameBySid

static bool x_GetAccountNameBySid(PSID sid, string* account, int* domatch = 0)
{
    _ASSERT(account);

    // Use predefined buffers for account/domain names to avoid additional
    // step to get its sizes. According to MSDN max account/domain size
    // do not exceed MAX_ACCOUNT_LEN symbols (char or wchar).

    TXChar   account_name[MAX_ACCOUNT_LEN + 2];
    TXChar   domain_name [MAX_ACCOUNT_LEN + 2];
    DWORD    account_size = sizeof(account_name)/sizeof(account_name[0]) - 1;
    DWORD    domain_size  = sizeof(domain_name)/sizeof(domain_name[0]) - 1;
    SID_NAME_USE use;

    // Always get both account & domain name, even we don't need last.
    // Because if domain name is NULL, this function can throw unhandled
    // exception in Unicode builds on some platforms.
    if ( !LookupAccountSid(NULL, sid, 
                           account_name, &account_size,
                           domain_name,  &domain_size, &use) ) {
        CNcbiError::SetFromWindowsError();
        return false;
    }

    // Save account information
    account_name[account_size] = _TX('\0');
    account->assign(_T_STDSTRING(account_name));

    if (domatch) {
        domain_name[domain_size] = _TX('\0');
        string domain(_T_STDSTRING(domain_name));
        if (*domatch != int(use)  ||  domain.empty()
            ||  NStr::EqualNocase(domain, "builtin")
            ||  NStr::FindNoCase(domain, " ") != NPOS
            /*||  x_DomainIsLocalComputer(domain_name)*/) {
            *domatch = 0;
        }
    }
    return true;
}
开发者ID:DmitrySigaev,项目名称:ncbi,代码行数:40,代码来源:ncbi_os_mswin.cpp

示例13: launchNewtonOMP

int launchNewtonOMP(){
    omp_set_num_threads(THREADS);

    std::cout << "Launch Newton with OMP" << std::endl;

    char** argv = NULL;
    GLUTWindowManagers::init(0, argv);

    int w = 800;
    int h = 800;

    DomaineMaths domain(-w / 2, - h / 2, w, h);

    NewtonImageOMP* functionalImage = new NewtonImageOMP(w, h, domain);
    FractaleGLImage* functionSelections = new FractaleGLImage(functionalImage);

    GLUTWindowManagers* windowManager = GLUTWindowManagers::getInstance();
    windowManager->createWindow(functionSelections);
    windowManager->runALL(); //This call is blocking

    return 0;
}
开发者ID:mse-gpu,项目名称:Newton,代码行数:22,代码来源:main.cpp

示例14: throw

/** \brief Start the operation
 */
slay_err_t	slay_resp_btjamrc4_t::start(const slay_resp_arg_t &resp_arg)		throw()
{
	// sanity check - slay_resp_arg_t MUST be valid
	DBG_ASSERT( resp_arg.is_valid() );
	// sanity check - resp_arg.domain() MUST be the local one
	DBG_ASSERT( resp_arg.domain() == domain() );
	
	// if resp_arg.profile_present(), copy it
	if( resp_arg.profile_present() )	m_slay_profile	= resp_arg.profile();

	// set the tls_profile_t to m_btjamrc4_resp
	const slay_profile_btjamrc4_t & dom_profile	= slay_profile_btjamrc4_t::from_slay(resp_arg.profile());
	m_btjamrc4_resp.profile( dom_profile.bt_jamrc4() );

	// start the bt_jamrc4_resp_t
	bt_err_t	bt_err;
	bt_err		= m_btjamrc4_resp.start();
	if( bt_err.failed() )	return slay_err_from_bt(bt_err);
	
	// return no error	
	return slay_err_t::OK;
}
开发者ID:jeromeetienne,项目名称:neoip,代码行数:24,代码来源:neoip_slay_resp_btjamrc4.cpp

示例15: backupToTar

/*
 * Write files to the given output.  This implementation does *not* create
 * a standalone archive suitable for restore on its own.  In particular, the identification of
 * the application's name etc is not in-band here; it's assumed that the calling code has
 * taken care of supplying that information previously in the output stream.
 *
 * The file format is 'tar's, with special semantics applied by use of a "fake" directory
 * hierarchy within the tar stream:
 *
 * apps/packagename/a/Filename.apk - this is an actual application binary, which will be
 *   installed on the target device at restore time.  These need to appear first in the tar
 *   stream.
 * apps/packagename/obb/[relpath] - OBB containers belonging the app
 * apps/packagename/r/[relpath] - these are files at the root of the app's data tree
 * apps/packagename/f/[relpath] - this is a file within the app's getFilesDir() tree, stored
 *   at [relpath] relative to the top of that tree.
 * apps/packagename/db/[relpath] - as with "files" but for the getDatabasePath() tree
 * apps/packagename/sp/[relpath] - as with "files" but for the getSharedPrefsFile() tree
 * apps/packagename/c/[relpath] - as with "files" but for the getCacheDir() tree
 *
 * and for the shared storage hierarchy:
 *
 * shared/[relpaths] - files belonging in the device's shared storage location.  This will
 *    *not* include .obb files; those are saved with their owning apps.
 *
 * This method writes one file data block.  'domain' is the name of the appropriate pseudo-
 * directory to be applied for this file; 'linkdomain' is the pseudo-dir for a relative
 * symlink's antecedent.
 *
 * packagename: the package name to use as the top level directory tag
 * domain:      which semantic name the file is to be stored under (a, r, f, db, etc)
 * linkdomain:  where a symlink points for purposes of rewriting; current unused
 * rootpath:    prefix to be snipped from full path when encoding in tar
 * path:        absolute path to the file to be saved
 * dataOutput:  the BackupDataOutput object that we're saving into
 */
static int backupToTar(JNIEnv* env, jobject clazz, jstring packageNameObj,
        jstring domainObj, jstring linkdomain,
        jstring rootpathObj, jstring pathObj, jobject dataOutputObj) {
    int ret;

    // Extract the various strings, allowing for null object pointers
    const char* packagenamechars = (packageNameObj) ? env->GetStringUTFChars(packageNameObj, NULL) : NULL;
    const char* rootchars = (rootpathObj) ? env->GetStringUTFChars(rootpathObj, NULL) : NULL;
    const char* pathchars = (pathObj) ? env->GetStringUTFChars(pathObj, NULL) : NULL;
    const char* domainchars = (domainObj) ? env->GetStringUTFChars(domainObj, NULL) : NULL;

    String8 packageName(packagenamechars ? packagenamechars : "");
    String8 rootpath(rootchars ? rootchars : "");
    String8 path(pathchars ? pathchars : "");
    String8 domain(domainchars ? domainchars : "");

    if (domainchars) env->ReleaseStringUTFChars(domainObj, domainchars);
    if (pathchars) env->ReleaseStringUTFChars(pathObj, pathchars);
    if (rootchars) env->ReleaseStringUTFChars(rootpathObj, rootchars);
    if (packagenamechars) env->ReleaseStringUTFChars(packageNameObj, packagenamechars);

    // Extract the data output fd
    BackupDataWriter* writer = (BackupDataWriter*) env->GetIntField(dataOutputObj,
            sBackupDataOutput.mBackupWriter);

    // Validate
    if (!writer) {
        LOGE("No output stream provided [%s]", path.string());
        return -1;
    }

    if (path.length() < rootpath.length()) {
        LOGE("file path [%s] shorter than root path [%s]",
                path.string(), rootpath.string());
        return -1;
    }

    return write_tarfile(packageName, domain, rootpath, path, writer);
}
开发者ID:0xr0ot,项目名称:frameworks_base,代码行数:75,代码来源:android_app_backup_FullBackup.cpp


注:本文中的domain函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。