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


C++ TPZVec::NElements方法代码示例

本文整理汇总了C++中TPZVec::NElements方法的典型用法代码示例。如果您正苦于以下问题:C++ TPZVec::NElements方法的具体用法?C++ TPZVec::NElements怎么用?C++ TPZVec::NElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPZVec的用法示例。


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

示例1:

int TPZSkylMatrix<TVar>::NumElements(const TPZVec<int> &skyline) {
	int dim = skyline.NElements();
	int i,nelem=0;
	for(i=0; i<dim; i++) nelem += i-skyline[i]+1;
	return nelem;
}
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:6,代码来源:pzskylmat.cpp

示例2: Resequence

void TPZSloan::Resequence(TPZVec<int> &perm, TPZVec<int> &iperm)
{

	if(!fNNodes || !fNElements)
 	{
	   std::cout << __PRETTY_FUNCTION__ << " called with fNNodes = " << fNNodes
	       << " and fNElements = " << fNElements << std::endl;
	   return;
	}
	
	/**
	int nen = 2;                          // number of nodes per element
	int *npn = new int[nen * n_elements]; // npn[i..i+nen] contains adjacent nodes of element i
	int *xnpn = new int[n_elements+1];	  // xnpn[i] index of element i in npn

	Now npn and xnpn are fElementGraph and fElementGraphIndex respectively
	*/
	//feed npn and xnpn with data from jj and jk
	int i;
//	int k=0;
	int nnodes_per_element=fMaxNodesElement;
	
	TPZVec<int> elementgraph(fElementGraph.NElements()+1);
	TPZVec<int> elementgraphindex(fElementGraphIndex.NElements()+1);
	
	int n = fElementGraph.NElements();
	for (i=0; i<n; i++) {
		elementgraph[i+1] = fElementGraph[i]+1;
	}
	n = fElementGraphIndex.NElements();
	for (i=0; i<n; i++) {
		elementgraphindex[i+1] = fElementGraphIndex[i]+1;
	}

	int iadj = elementgraph.NElements()* nnodes_per_element* (nnodes_per_element-1);
	TPZVec<int> adj(iadj);
	TPZVec<int> xadj(fNNodes+2,-1);
	int nop = 0;
	int inpn = nnodes_per_element * fNElements;

	//adjacency list generation
	//ofstream sai("felementgraph.txt");
	//fElementGraph.Print(sai);
	//int *npn = new int [iadj];
	//npn=fElementGraph;
	//int *xnpn = new int[iadj];
	//xnpn=fElementGraphIndex;
	//int *adj = new int [iadj];
	//int *xadj = new int[iadj];
	// Print the element graph
#ifdef SLOANDEBUG
	int iel;
	for(iel=0; iel<fNElements; iel++)
	{
		int firstindex = elementgraphindex[iel+1];
		int lastindex = elementgraphindex[iel+2];
		int no;
		cout << "Element : " << iel+1 << " : ";
		for(no = firstindex; no<lastindex; no++)
		{
			cout << elementgraph[no] << " ";
		}
		cout << endl;
	}
#endif
  static pthread_mutex_t Lock_clindex = PTHREAD_MUTEX_INITIALIZER;
	pthread_mutex_lock(&Lock_clindex);
	gegra_(&fNNodes, &fNElements, &inpn, &elementgraph[1], &elementgraphindex[1], &iadj, &adj[0], &xadj[0], &nop);
	pthread_mutex_unlock(&Lock_clindex);
	//gegra_(&fNNodes, &fNElements, &inpn, npn, xnpn, &iadj, adj, xadj, &nop);
#ifdef SLOANDEBUG
	cout << "node index vector ";
	int no;
	for(no=0; no<xadj.NElements(); no++)
	{
		cout << xadj[no] << " ";
		if(no && !(no%30)) cout << endl;

	}
	cout << endl;
	for(no=0; no<fNNodes; no++)
	{
		int firstindex = xadj[no]-1;
		int lastindex = xadj[no+1]-1;
		int el;
		cout << "Node : " << no+1 << " : ";
		for(el = firstindex; el<lastindex; el++)
		{
			cout << adj[el] << " ";
		}
		cout << endl;
	}
#endif
	TPZVec<int> iw(nnodes_per_element*(fNElements+1)*10);
	//int *iw = new int [nnodes_per_element*(fNElements+1)];
	int e2 = xadj[fNNodes]-1;

	//int *NowPw
	//Where to obtain n_nodes ?
	//rewriting with new order
//.........这里部分代码省略.........
开发者ID:JoaoFelipe,项目名称:oceano,代码行数:101,代码来源:pzsloan.cpp


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