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


C++ combine函数代码示例

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


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

示例1: PLB_PRECONDITION

void MultiBlock3D::addModifiedBlocks (
        plint level,
        std::vector<MultiBlock3D*> modifiedBlocks,
        std::vector<modif::ModifT> typeOfModification,
        std::vector<std::vector<BlockAndModif> >& multiBlockCollection,
        bool includesEnvelope )
{
    PLB_PRECONDITION( modifiedBlocks.size() == typeOfModification.size() );
    // Resize vector which collects modified blocks (resize needs to be
    //   done even when no block is added, to avoid memory violations
    //   during read access to the vector).
    if ((pluint)level >= multiBlockCollection.size()) {
        multiBlockCollection.resize(level+1);
    }
    // Unless envelope is already included in the domain of application of the data
    //   processor, subscribe modified blocks for an update of the envelope.
    if (!includesEnvelope) {
        for (pluint iNewBlock=0; iNewBlock<modifiedBlocks.size(); ++iNewBlock) {
            bool alreadyAdded=false;
            // Check if the block is already in the collection.
            // Note: It may seem stupid to use a linear-complexity algorithm to
            // find existing blocks. However, it would be a mistake to store the data
            // processors in a sorted structure. Indeed, sorting pointers leads to
            // an unpredictable order (because the pointers have an unpredictable value).
            // This is a problem in parallel programs, because different threads may find a
            // different order, and the communication pattern between processes gets messed up.
            for (pluint iOriginal=0; iOriginal<multiBlockCollection[level].size(); ++iOriginal) {
                MultiBlock3D* existingBlock = multiBlockCollection[level][iOriginal].first;
                if (existingBlock == modifiedBlocks[iNewBlock]) {
                    // If the block already exists, simply update the type of modification
                    // that applies to it.
                    modif::ModifT& existingModif = multiBlockCollection[level][iOriginal].second;
                    existingModif = combine( existingModif, typeOfModification[iNewBlock] );
                    alreadyAdded = true;
                }
            }
            // If the block is not already in the structure, add it.
            if (!alreadyAdded) {
                multiBlockCollection[level].push_back (
                        BlockAndModif( modifiedBlocks[iNewBlock], typeOfModification[iNewBlock] ) );
            }
        }
    }
}
开发者ID:jannickseelen,项目名称:Palabos,代码行数:44,代码来源:multiBlock3D.cpp

示例2: TAOLIB_DEBUG

    CORBA::Object_ptr
    ImR_Client_Adapter_Impl::imr_key_to_object(TAO_Root_POA* poa,
                                               const TAO::ObjectKey &key,
                                               const char* type_id) const
    {
      TAO_ORB_Core& orb_core = poa->orb_core ();
      // Check to see if we alter the IOR.
      CORBA::Object_var imr = orb_core.implrepo_service ();

      if (CORBA::is_nil (imr.in ())
          || !imr->_stubobj ()
          || !imr->_stubobj ()->profile_in_use ())
        {
          if (TAO_debug_level > 1)
            {
              TAOLIB_DEBUG ((LM_DEBUG,
                             ACE_TEXT ("TAO_ImR_Client (%P|%t) - Missing ImR IOR, will not use the ImR\n")));
            }
          return CORBA::Object::_nil();
        }

      const TAO_MProfile& base_profiles = imr->_stubobj ()->base_profiles ();
      CORBA::String_var key_str;
      TAO::ObjectKey::encode_sequence_to_string (key_str.inout (), key);

      // if there is only one profile, no need to use IORManipulation
      if (base_profiles.profile_count() == 1)
        {
          return combine(orb_core,
                         *base_profiles.get_profile(0),
                         key_str.in(),
                         type_id);
        }

      // need to combine each profile in the ImR with the key and
      // then merge them all together into one ImR-ified ior
      ImRifyProfiles imrify (base_profiles,
                             imr->_stubobj ()->profile_in_use (),
                             orb_core,
                             key_str,
                             type_id);

      return imrify.combined_ior ();
    }
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:44,代码来源:ImR_Client.cpp

示例3: plot_funz_a2

void plot_funz_a2(const char *out_path,const char *title,const char *xlab,const char *ylab,double *X,bvec &Y,bvec &par,double (*fun)(double,double,double,double,double,double),boot &chiral_extrap_cont)
{
  //setup the plot
  grace out(out_path);
  out.plot_size(800,600);
  out.plot_title(combine("Continuum extrapolation of %s",title).c_str());
  out.axis_label(xlab,ylab);
  
  //plot the function with error
  double X_pol[100],X2_pol[100];
  bvec Y_pol(100,nboot,njack);
  for(int iens=0;iens<100;iens++)
    {
      X_pol[iens]=0.1/99*iens;
      X2_pol[iens]=X_pol[iens]*X_pol[iens];
	for(int iboot=plot_iboot=0;iboot<nboot+1;plot_iboot=iboot++)
	  Y_pol.data[iens].data[iboot]=fun(par[0][iboot],par[1][iboot],par[2][iboot],par[3][iboot],ml_phys[iboot],X_pol[iens]/hc);
    }
  out.set(1,"yellow");
  out.polygon(X2_pol,Y_pol);
  out.new_set();
  out.set(1,"red");
  out.set_line_size(2);
  out.ave_line(X2_pol,Y_pol);
  out.new_set();

  //plot the data with error
  for(int ib=0;ib<nbeta;ib++)
    {
      out.set(4,"none",set_symbol[ib],set_color[ib],"filled");
      out.set_legend(set_legend_fm[ib]);
      out.set_line_size(2);
      out.fout<<"@type xydy"<<endl;
      out.fout<<X[ib]*X[ib]<<" "<<Y.data[ib]<<endl;
      out.new_set();
    }
  
  //plot the extrapolated point with error
  out.set(4,"none","circle","indigo","filled");
  out.set_line_size(3);
  out.set_legend("Physical point");
  out.print_graph(0,chiral_extrap_cont);
  out.new_set();
}
开发者ID:sunpho84,项目名称:sunpho,代码行数:44,代码来源:extr_adim.cpp

示例4: updateTree

void updateTree(int index, int pos, int bl, int br, int val)
{
  if(bl == br)
  {
    tree[index].sum = val;
    tree[index].pref_sum = tree[index].suff_sum = tree[index].ans = max(0, val);
    return;
  }
  int localCenter = bl + (br - bl) / 2;
  if(pos <= localCenter)
  {
    updateTree(index * 2 + 1, pos, bl, localCenter, val);
  }
  else
  {
    updateTree(index * 2 + 2, pos, localCenter + 1, br, val);
  }
  tree[index] = combine(tree[index * 2 + 1], tree[index * 2 + 2]);
}
开发者ID:tupieurods,项目名称:SportProgramming,代码行数:19,代码来源:main.cpp

示例5: combine

void combine(int maxLength, int currentPosition, char toPrint[output_length]) {		
	if(currentPosition < maxLength) {
		for(int i = 0; i < array_size; ++i) {
			
			char newArray[output_length + 1];
			memcpy(newArray, toPrint, sizeof(toPrint));
			newArray[currentPosition] = letters[i];
			newArray[currentPosition + 1] = '\0';

			if(currentPosition + 1 == maxLength) {
				printf("%s\n", &newArray);
				counter++;
			}
			
			combine(maxLength, currentPosition + 1, newArray);
		}
		
	} 
}
开发者ID:nahlik-michal,项目名称:PJC-cv2,代码行数:19,代码来源:kombinace_rekurze.cpp

示例6: merge

 ListNode* merge(ListNode* l, ListNode* r) {
     ListNode combine(0);
     ListNode* lastNode = &combine;
     while (l != NULL && r != NULL) {
         if (l->val < r->val) {
             lastNode->next = l;
             l = l->next;
         } else {
             lastNode->next = r;
             r = r->next;
         }
         lastNode = lastNode->next;
     }
     if (l != NULL)
         lastNode->next = l;
     else
         lastNode->next = r;
     return combine.next;
 }
开发者ID:hongchh,项目名称:leetcode,代码行数:19,代码来源:023-merge-k-sorted-lists.cpp

示例7: luaC_complie

const char* luaC_complie(lua_State* L, const char* szSrcFile, const char* szDesFile)
{
	const Proto* f;
	FILE* D;
	if (luaL_loadfile(L,szSrcFile)!=0)
	{
		return lua_tostring(L, -1);
	}
	f = combine(L, 1);


	D = fopen_k(szDesFile, "wb");
	lua_lock(L);
	luaU_dump(L, f, writer, D, 0);
	lua_unlock(L);
	fclose(D);
	
	return 0;
}
开发者ID:zhuxiaokun,项目名称:workshop,代码行数:19,代码来源:luacompiler.c

示例8: luaC_complieN

const char* luaC_complieN(lua_State* L, const char* szDesFile, int count)
{
	const Proto* f;
	FILE* D;
	if (!lua_checkstack(L, count))
	{
		return "too much files, can not compile once";
	}
	f = combine(L, count);


	D = fopen_k(szDesFile, "wb");
	lua_lock(L);
	luaU_dump(L, f, writer, D, 0);
	lua_unlock(L);
	fclose(D);

	return 0;
}
开发者ID:zhuxiaokun,项目名称:workshop,代码行数:19,代码来源:luacompiler.c

示例9: query

//Complexity: O(log n)
int query(int t, int i, int j, int l, int r) {
	if (l <=i && j <= r) {
		return seg[t];
	}
	int mid = (i + j) / 2;
	if (l <= mid) {
		if (r <= mid) {
			return query(t*2, i, mid, l, r);
		}
		else {
			int a = query(t*2, i, mid, l, r);
			int b = query(t*2 + 1,  mid + 1, j, l, r);
			return combine(a, b);
		}
	}
	else {
		return query(t*2 + 1,  mid + 1, j, l, r);
	}
}
开发者ID:ravsa,项目名称:Competitive-Coding,代码行数:20,代码来源:segtree.cpp

示例10: parallel_for

void parallel_for(Number lo, Number hi, const Body& body) {
#if defined(SEQUENTIAL_ELISION)
  for (Number i = lo; i < hi; i++)
    body(i);
    /* cilk_for not yet supported by mainline gcc
#elif defined(USE_CILK_RUNTIME)
  cilk_for (Number i = lo; i < hi; i++)
    body(i);
    */
#else
  struct { } output;
  using output_type = typeof(output);
  auto join = [] (output_type,output_type) { };
  auto _body = [&body] (Number i, output_type) {
    body(i);
  };
  combine(lo, hi, output, join, _body);
#endif
}
开发者ID:grtkachenko,项目名称:pasl,代码行数:19,代码来源:native.hpp

示例11: printf

int car_module::savedatetomysql()
{
	FILE* fpout;
	fpout=fopen("date.txt","w");
	if(fpout==NULL)
	{
		printf("can not open date.txt\n");
		return 1;
	}
	fprintf(fpout,"%d\n",mac);
	fprintf(fpout,"%d %d\n",rows,cols);
	fprintf(fpout,"%.3lf %.3lf\n",speed_rows,speed_cols);
	for(int i=0;i<rows*cols;i++)
	{
		fprintf(fpout,"%d ",combine(map_queue[i].id,map_queue[i].idle));
	}
	fclose(fpout);
	return 0;
}
开发者ID:flair2005,项目名称:mechanical_parking_system,代码行数:19,代码来源:car_module.cpp

示例12: subsets

 vector<vector<int>> subsets(vector<int>& nums) {
     vector<vector<int>> result;
     vector<int> solution;
     // empty set
     result.push_back(solution);
     
     if (nums.size() <= 0) {
         return result;
     }
     
     sort(nums.begin(), nums.end());
     
     for (int sub_size = 1; sub_size <= nums.size(); sub_size++) {
         // using backtracking, get all subset, which size is sub_size
         vector<vector<int>> subs = combine(nums, sub_size);
         // extend result: put sub in subs to result
         result.insert(result.end(), subs.begin(), subs.end());
     }
     return result;
 }
开发者ID:Shitaibin,项目名称:leetcode-2016,代码行数:20,代码来源:78.Subsets.cpp

示例13: merge

Matrix merge(const Matrix &A, const Matrix &B, int s, bool can_nine) {
	Matrix res;
	for ( int i = 0; i <= 9; i ++ )
		for ( int j = 0; j <= 9; j ++ ) {
			Info I1 = A.ele[i][j];
			I1.val ++;
			for ( int x = 1; x <= 9; x ++ )
				if ( (s & (1 << x)) || x == j || (can_nine && x == 9) ) {
					int t = x + j;
					if ( t >= 10 ) {
						t -= 10;
						for ( int k = 0; k <= 9; k ++ ) {
							Info I2 = B.ele[t][k];
							res.ele[i][k].update(combine(I1, I2));
						}
					}
				}
		}
	return res;
}
开发者ID:alxsoares,项目名称:OI,代码行数:20,代码来源:inint_TLE.cpp

示例14: PyList_GetItem

/* recursively generate a patch of all bins between start and end */
static struct flist *fold(PyObject *bins, Py_ssize_t start, Py_ssize_t end)
{
	Py_ssize_t len, blen;
	const char *buffer;

	if (start + 1 == end) {
		/* trivial case, output a decoded list */
		PyObject *tmp = PyList_GetItem(bins, start);
		if (!tmp)
			return NULL;
		if (PyObject_AsCharBuffer(tmp, &buffer, &blen))
			return NULL;
		return decode(buffer, blen);
	}

	/* divide and conquer, memory management is elsewhere */
	len = (end - start) / 2;
	return combine(fold(bins, start, start + len),
		       fold(bins, start + len, end));
}
开发者ID:Distrotech,项目名称:mercurial,代码行数:21,代码来源:mpatch.c

示例15: get_money_of_company

long long int get_money_of_company(double_queue_t *q, int idx, int id, long source) {
  void *query, *response;
  size_t qlen, response_size;
  int exit_on_signal = 0;
  combine(&query, &qlen, "%c %i %i", ACT_BANK_GET_SALDO, idx, id);
  if(double_queue_query(q, query, qlen, &response, &response_size, &exit_on_signal, source, bank_ip) != 0) {
    error("Error connecting to bank.");
    free(query);
    return -1;
  }
  long long int saldo = -1;
  free(query);
  if(match(response, response_size, "@c %ll", ACT_OK, &saldo) != 0) {
    error("Expected OK message - something went wrong.");
    free(response);
    return -1;
  }
  free(response);
  return saldo;
}
开发者ID:wojtex,项目名称:studia-so-archeo,代码行数:20,代码来源:bank_utils.c


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