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


C++ StringT::Tail方法代码示例

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


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

示例1: ReadConnectivity

void TextInputT::ReadConnectivity (const StringT& name, iArray2DT& connects)
{
  ifstreamT geo;
  OpenFile (geo, ".geo");

  if (!AdvanceToBlock (geo, name, "Connectivities")) throw ExceptionT::kDatabaseFail;

  StringT s;
  int numelms, numelnodes;
  iArrayT elms (connects.MinorDim());
  if (!geo.FindString ("Number of elements", s) ||
      !s.Tail ('=', numelms) ||
      !geo.FindString ("Number of element nodes", s) ||
      !s.Tail ('=', numelnodes) ||
      !geo.FindString ("element", s)) throw ExceptionT::kDatabaseFail;

  if (numelms != connects.MajorDim() ||
      numelnodes != connects.MinorDim()) throw ExceptionT::kSizeMismatch;

	for (int i=0; i < numelms; i++)
	{
		int elm_dex, elm_id; 
		geo >> elm_dex>> elm_id >> elms;
		connects.SetRow (i, elms);
	}
	connects--;
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:27,代码来源:TextInputT.cpp

示例2: ReadGlobalElementSet

void TextInputT::ReadGlobalElementSet (const StringT& name, iArrayT& set)
{
  if (set.Length() != fNumElements) throw ExceptionT::kSizeMismatch;

  ifstreamT geo;
  OpenFile (geo, ".geo");

  StringT s;
  int numelms;
  int count = 0;
  const int ID = atoi (name.Pointer());
  int found = -1;
  while (found != ID)
    {
      if (!geo.FindString ("Connectivities", s) ||
	  !geo.FindString ("Number of elements", s) ||
	  !s.Tail ('=', numelms) ||
	  !geo.FindString ("element", s)) throw ExceptionT::kDatabaseFail;

      count += numelms;
    }
  
  if (set.Length() != numelms) throw ExceptionT::kSizeMismatch;
  set.SetValueToPosition();
  set += count;
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:26,代码来源:TextInputT.cpp

示例3: ReadGlobalElementMap

void TextInputT::ReadGlobalElementMap (const StringT& name, iArrayT& elemmap)
{
  ifstreamT geo;
  OpenFile (geo, ".geo");

  StringT s;
  int numelms;
  char line [255];
  if (!AdvanceToBlock (geo, name, "Connectivities") ||
      !geo.FindString ("Number of elements", s) ||
      !s.Tail ('=', numelms)) throw ExceptionT::kDatabaseFail;
  if (elemmap.Length() != numelms) throw ExceptionT::kSizeMismatch;

	/* advance to the start of the connectivity block */
	if (!geo.FindString("index", s)) throw ExceptionT::kDatabaseFail;
	
	/* read map */
	elemmap = 0;
	for (int i=0; i < numelms; i++)
	{
		int index;
		geo >> index >> elemmap[i];
		geo.getline (line, 254);
    }
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:25,代码来源:TextInputT.cpp

示例4: ReadAllElementMap

void TextInputT::ReadAllElementMap (iArrayT& elemmap)
{
  if (elemmap.Length() != fNumElements) throw ExceptionT::kSizeMismatch;

  ifstreamT geo;
  OpenFile (geo, ".geo");

  StringT s;
  int numelms;
  int count = 0;
  char line [255];
  for (int i=0; i < fBlockID.Length(); i++)
    {
      if (!geo.FindString ("Connectivities", s) ||
	  !geo.FindString ("Number of elements", s) ||
	  !s.Tail ('=', numelms) ||
	  !geo.FindString ("element", s)) throw ExceptionT::kDatabaseFail;

      for (int i=0; i < numelms; i++)
	{
	  geo >> elemmap[count++];
	  geo.getline (line, 254);
	}
    }
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:25,代码来源:TextInputT.cpp

示例5: ScanResultsFile

bool TextInputT::ScanResultsFile(ifstreamT& in)
{
	/* is old format */
	if (is_old_format(in.filename())) return ScanResultsFile_old(in);

	/* advance */
	StringT s;
	if (!in.FindString ("O U T P U T", s)) return false;

	/* first file name */
	StringT file;
	in >> file;
	if (!in.good()) return false;
	
	/* open first results file */
	StringT path, file_path;
	file_path.FilePath(in.filename());
	file_path.Append(file);
	ifstreamT dat(file_path);
	if (!dat.is_open()) {
		cout << "\n TextInputT::ScanResultsFile: error opening file: " << file_path << endl;
		return false;
	}

	/* get dimension from first file */
	if (!dat.FindString ("Group number", s)) return false;
	double t;
	if (!dat.FindString ("Time", s) || !s.Tail ('=', t)) return false;
	fTimeSteps.Append(t);
	if (!dat.FindString ("Number of blocks", s)) return false;

	/* scan nodal output labels */
	fNodeVariable.Free();
	int vals;
	if (!dat.FindString ("Nodal data", s) ||
        !dat.FindString ("Number of values", s) ||
        !s.Tail('=', vals)) {
		cout << "\n TextInputT::ScanResultsFile: error scanning nodal values" << endl;
		return false;
	}
	if (vals > 0) {
		dat >> s >> s; /* "index" and "node" */
		for (int v = 0; v < vals; v++) {
			dat >> s;
			fNodeVariable.Append(s);
		}
	}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:47,代码来源:TextInputT.cpp

示例6: ScanGeometryFile

bool TextInputT::ScanGeometryFile (ifstreamT& in)
{
  StringT s;
  if (!in.FindString ("G E O M E T R Y", s)) return false;
  
	/* get number of element blocks */
	int num_blocks;
	if (!in.FindString ("Number of blocks", s) ||
	    !s.Tail ('=', num_blocks)) return false;

	/* coordinate data */
	if (!in.FindString ("Nodal coordinates", s)) return false;
	fNumNodes = 0;
	fNumDOF = 0;
	if (!in.FindString ("Number of nodal points", s) || !s.Tail ('=', fNumNodes)) 
		return false;
	if (!in.FindString ("Number of values", s) || !s.Tail ('=', fNumDOF)) 
		return false;
	
	/* scan block data */
	fNumElements = 0;
	if (!in.FindString ("Connectivities", s)) return false;
	for (int i = 0; i < num_blocks; i++)
	{
		StringT nid;
		if (!in.FindString ("Block ID", s) || !s.Tail ('=', nid)) 
			return false;
		fBlockID.Append(nid);
	
		int nel;
		if (!in.FindString ("Number of elements", s) || !s.Tail ('=', nel))
			return false;
		fBlockNumElem.Append(nel);
		fNumElements += nel;

		int nen;
		if (!in.FindString ("Number of element nodes", s) || !s.Tail ('=', nen))
			return false;
		fBlockNumElemNode.Append(nen);

		int icode;
		if (!in.FindString("Geometry code", s) || !s.Tail ('=', icode))
			return false;
		GeometryT::CodeT code = GeometryT::CodeT(icode);
		fBlockGeometry.Append(code);
	}

	/* return */
	if (fBlockID.Length() < 1) 
		return false;
	else
		return true;
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:53,代码来源:TextInputT.cpp

示例7: ReadElementVariables

void TextInputT::ReadElementVariables(int step, const StringT& name, dArray2DT& evalues)
{
	const char caller[] = "TextInputT::ReadElementVariables";
		
	StringT toc_file(fFileRoot);
	toc_file.Append(".run");
	if (is_old_format(toc_file)) {
		ReadElementVariables_old(step, name, evalues);
		return;
	}

	/* resolve block index */
	int dex = fBlockID.PositionOf(name);
	if (dex == -1)
		ExceptionT::DatabaseFail(caller, "could not find block ID %s", name.Pointer());

	/* get file for specified step */
	StringT file;
	ResultsFile(toc_file, step, file);

	/* open results file */
	StringT results_file(fFilePath);
	results_file.Append(file);
  	ifstreamT run(results_file);
  	if (!run.is_open())
  		ExceptionT::GeneralFail(caller, "could not open file %s", results_file.Pointer());
	
	/* advance to the edge of the nodal data block */
	StringT s;
	if (!run.FindString ("Nodal data", s)) ExceptionT::DatabaseFail(caller);

	/* advance to block */
	for (int i = 0; i <= dex; i++)
		if (!run.FindString ("Element data", s)) 
			ExceptionT::DatabaseFail(caller);

	/* verify block */
	StringT block_ID;
	if (!run.FindString ("Block ID", s) ||
        !s.Tail('=', block_ID)) ExceptionT::DatabaseFail(caller);
	if (name != block_ID)
		ExceptionT::DatabaseFail(caller, "found block ID %s at position %d instead of ID %s",
			block_ID.Pointer(), dex, name.Pointer());

	/* read */
	iArrayT used (fElementVariable.Length()), ids;
	DataBlock(run, used, ids, evalues, false);	
}
开发者ID:samanseifi,项目名称:Tahoe,代码行数:48,代码来源:TextInputT.cpp


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