// ------------------ deprecated ------------------------
Zone_t Base_t::readZone( int index, string& zonename, vector<int>& zsize, ZoneType_t& type ) const
{
	cgnsstring zname;
	Array<int> size(9); // What is the max number of dimensions???
	int ier;
	ier = cg_zone_read( getFileID(), getID(), ++index, zname, size );
	check_error( "Base_t::getZone", "cg_zone_read", ier );
	ier = cg_zone_type( getFileID(), getID(), index, &type );
	check_error( "Base_t::getZone", "cg_zone_type", ier );

	// copy to user parameters
	zonename = zname;
	int n = (type==Unstructured) ? 1 : getCellDimension();   // don't call get_index_dimension - 'this' is not a Zone_t!
	zsize.resize(3*n);
	for ( int i=0 ; i<2*n ; i++ )
		zsize[i] = size[i];
	if ( type==Structured )
	{
		// in a structured Zone_t, the number of boundary vertices is always zero and is not transmitted by the MLL
		for ( int i=0 ; i<n ; i++ )
			zsize[2*n+i] = 0;
	}
	else
	{
		zsize[2] = size[2];
	}

	return Zone_t(push("Zone_t",index));
}
/*! Writes a Family_t under this Base
 * \param famname Name of the family [Input]
 * \return Handle to the Family_t structure
 */
Family_t Base_t::writeFamily( const string& famname )
{
	int ifam;
	int ier = cg_family_write( getFileID(), getID(), famname.c_str(), &ifam );
	check_error( "Base_t::writeFamily", "cg_family_write", ier );
	return Family_t(push("Family_t", ifam),0,0);
}
Gravity_t Base_t::writeGravity( const vector<float>& gvect )
{
	Array<float> ag(gvect);
	int ier = cg_gravity_write( getFileID(), getID(), ag );
	check_error( "Base_t::writeGravity", "cg_gravity_write", ier );
	return Gravity_t(push( "Gravity_t", 1 ));
}
Axisymetry_t Base_t::writeAxisymmetry( const vector<float>& refpt, const vector<float>& axis )
{
	Array<float> apt(refpt), ax(axis);
	int ier = cg_axisym_write( getFileID(), getID(), apt, ax );
	check_error( "Base_t::writeAxiSymmetry", "cg_axisym_write", ier );
	return Axisymetry_t(push( "Axisymmetry_t", 1 ));
}
/*! Gets the number of Family_t under this Base
 * \return Number of Family_t under this Base
 */
int Base_t::getNbFamily() const
{
	int n;
	int ier = cg_nfamilies( getFileID(), getID(), &n );
	check_error( "Base_t::getNbFamily", "cg_nfamilies", ier );
	return n;
}
/*!
 * Writes the BCData associated with this BCDataSet_t
 * \param dtype  Type of BCData (Dirichlet or Neumann)
 * \return Handle to the newly writen BCData_t  
 */
BCData_t BCDataSet_t::writeBCData( BCDataType_t dtype )
{
	if ( parent().isA( "BC_t" ) )
	{
		// we are in <Base/Zone/ZoneBC/BC/BCDataSet> - get indices of all nodes in the hierarchy
		int ids   = getID();
		int ibc   = parent().getID();
		int izone = parent().parent().parent().getID();
		int ibase = parent().parent().parent().parent().getID();
		int ier = cg_bcdata_write( getFileID(), ibase, izone, ibc, ids, dtype );
		check_error( "BCDataSet_t::writeBCData", "cg_bcdata_write", ier );
		return BCData_t( push( "BCData_t", dtype ) ); // see documentation of cg_goto for the peculiar usage of dtype here
	}
	else if ( parent().isA( "FamilyBC_t" ) )
	{
		// the BCType goes into the BCDataSet - not yet written!
		// write the BCDataSet (or overwrite it if it already exists)
		parent().go_here(); // point to FamilyBC_t
		// get dataset name and BCType from attribute info (see FamilyBC_t class)
		string dsn;
		BCType_t bct;
		get_attribute( "Name", dsn );
		get_attribute( "BCType", bct );
		int ier = cg_bcdataset_write( const_cast<char*>(dsn.c_str()), bct, dtype );
		check_error( "BCDataSet_t::writeBCData", "cg_bcdataset_write", ier );

		return BCData_t( push( "BCData_t", dtype ) );
	}
	throw std::logic_error( "BCDataSet_t::writeBCData - immediate parent is not a BC_t nor a FamilyBC_t ??? !!!" );
}
/*! Returns the number of Zone_t under the Base_t
 * \return Number of Zone_t structures
 */
int Base_t::getNbZone() const
{
	int nzones;
	int ier = cg_nzones( getFileID(), getID(), &nzones );
	check_error( "Base_t::getNbZone", "cg_nzones", ier );
	return nzones;
}
void Base_t::readSimulationType( SimulationType_t& sptr ) const
{
	SimulationType_t s;
	int ier = cg_simulation_type_read( getFileID(), getID(), &s );
	check_error( "Base_t::readSimulationtype", "cg_simulation_type_read", ier );
	sptr = s;
}
Пример #9
0
// Called to enable the block to print its entry and exit text
void scope::printEntry(string loadCmd) {
  //cout << getLabel()<<": blockIndex="<<blockIndex<<endl;
  dbg.ownerAccessing();
  /*if(blockIndex==0) {
    //if(dbg.blockDepth()>2) dbg << "\t\t\t"<<tabs(dbg.blockDepth())<<"</td></tr></table>\n";
    dbg << "\t\t\t"<<tabs(dbg.blockDepth())<<"<table>\n";
    dbg << "\t\t\t"<<tabs(dbg.blockDepth())<<"<tr width=\"100%\"><td width=0></td><td width=\"100%\">\n";
  } //else
    //dbg << "\t\t\t"<<tabs(dbg.blockDepth())<<"</td></tr>\n";
  */
  
  dbg << "\t\t\t"<<tabs(dbg.blockDepth()+1)<<"<table bgcolor=\"#"<<colors[(colorIdx-1)%colors.size()]<<"\" width=\"100%\" id=\"table"<<getBlockID()<<"\" style=\"border:1px solid white\" onmouseover=\"this.style.border='1px solid black'; highlightLink('"<<getBlockID()<<"', '#F4FBAA');\" onmouseout=\"this.style.border='1px solid white'; highlightLink('"<<getBlockID()<<"', '#FFFFFF');\" onclick=\"focusLinkSummary('"<<getBlockID()<<"', event);\">\n";
  dbg << "\t\t\t"<<tabs(dbg.blockDepth()+1)<<"<tr width=\"100%\"><td width=0></td><td width=\"100%\">";
  if(labelInteractive) {
    dbg <<"<h2>\n";
    //dbg << "\t\t\t"<<tabs(dbg.blockDepth()+1)<<"<a name=\"anchor"<<getBlockID()<<"\" href=\"javascript:unhide('"<<getBlockID()<<"');\">";
    dbg << "\t\t\t"<<tabs(dbg.blockDepth()+1)<<"<a href=\"javascript:unhide('"<<getBlockID()<<"');\">";
  }
  
  if(labelShown) {
    dbg.userAccessing();
    dbg << getLabel();
    dbg.ownerAccessing();
  }
  
  if(labelInteractive) {
    dbg << "</a>\n";
    #if REMOTE_ENABLED
    if(saved_appExecInfo) {
      ostringstream setGDBLink; 
      setGDBLink << "\"javascript:setGDBLink(this, ':"<<GDB_PORT<<"/gdbwrap.cgi?"<<
                           "execFile="<<execFile<<"&"<<
                           "tgtCount="<<blockIDFromStructure<<"&"<<
                           "PWD="<<PWD<<"&"<<
                           "args=";
      for(int i=1; i<argc; i++) {
        if(i!=1) setGDBLink << " ";
        setGDBLink<< argv[i];
      }
      setGDBLink << "')\"";
  
      dbg << "<a href=\"#\" onclick="<<setGDBLink.str()<<" onmouseover="<<setGDBLink.str()<<"><img src=\"img/gdb.gif\" width=40 height=21 alt=\"GDB\"></a>\n";
    }
    #endif
    if(loadCmd != "") {
      dbg << "\t\t\t"<<tabs(dbg.blockDepth()+1);
      dbg << "<a href=\"javascript:"<<loadCmd<<")\">";
      //dbg << "<a href=\"javascript:loadURLIntoDiv(top.detail.document, '"<<detailContentURL<<".body', 'div"<<getBlockID()<<"'); loadURLIntoDiv(top.summary.document, '"<<summaryContentURL<<".body', 'sumdiv"<<getBlockID()<<"')\">";
      dbg << "<img src=\"img/divDL.gif\" width=25 height=35></a>\n";
      dbg << "\t\t\t<a target=\"_top\" href=\"index."<<getFileID()<<".html\">";
      dbg << "<img src=\"img/divGO.gif\" width=35 height=25></a>\n";
    }
    dbg << "\t\t\t"<<tabs(dbg.blockDepth()+1)<<"</h2>"<<endl;
  }
  dbg << "\t\t\t"<<tabs(dbg.blockDepth()+1)<<"</td></tr>\n";
  dbg << "\t\t\t"<<tabs(dbg.blockDepth()+1)<<"<tr width=\"100%\"><td width=0></td><td width=\"100%\">\n";
  dbg.flush();
  dbg.userAccessing();  
}
BaseIterativeData_t Base_t::readBaseIterativeData( string& name, int& nsteps ) const
{
	cgnsstring s;
	int ier = cg_biter_read( getFileID(), getID(), s, &nsteps );
	check_error( "Zone_t::readBaseIterativeData", "cg_biter_read", ier );
	name = s;
	return BaseIterativeData_t(push("BaseIterativeData_t",1));
}
// ---------------------- deprecated --------------------
Zone_t Base_t::writeZone( const string& zonename, vector<int>& dims, ZoneType_t type )
{
	int index;
	Array<int> adims(dims);
	int ier = cg_zone_write( getFileID(), getID(), zonename.c_str(), adims, type, &index );
	check_error( "Base_t::writeZone", "cg_zone_write", ier );
	return Zone_t(push( "Zone_t", index ));
}
Gravity_t Base_t::readGravity( vector<float>& gvect )  const
{
	Array<float> agvect(gvect);
	int ier = cg_gravity_read( getFileID(), getID(), agvect );
	check_error( "Base_t::readGravity", "cg_gravity_read", ier );
	gvect = agvect;
	return Gravity_t(push( "Gravity_t", 1 ));
}
Пример #13
0
unsigned int POGEL::IMAGE::loadandbuild()
{
    if(data==NULL)
    {
        load(getFileID().c_str());
    }
    return build();
}
Пример #14
0
unsigned Driver<Sage>::getFileID(SgScopeStatement * scope) const {
  SgFile * enclosing_file = SageInterface::getEnclosingFileNode(scope);
  assert(enclosing_file != NULL); // FIXME Contingency : Scope Stack

  SgSourceFile * enclosing_source_file = isSgSourceFile(enclosing_file);
  assert(enclosing_source_file != NULL);

  return getFileID(enclosing_source_file);
}
void GeometryReference_t::readPart( int ipart, string& partname ) const
{
	cgnsstring name;
	int ifam = parent().getID();
	int igeo = getID();
	int ier = cg_part_read( getFileID(), getBase().getID(), ifam, igeo, ipart, name );
	check_error( "GeometryReference_t::readPart", "cg_part_read", ier );
	partname = name;
}
void GeometryReference_t::writePart( const string& partname )
{
	int ipart;
	int ifam = parent().getID();
	int igeo = getID();
	int ier = cg_part_write( getFileID(), getBase().getID(), ifam, igeo, partname.c_str(), &ipart );
	check_error( "GeometryReference_t::writePart", "cg_part_write", ier );
	set_attribute( "NbGeoParts", ipart );
}
Axisymetry_t Base_t::readAxisymmetry( vector<float>& refpt, vector<float>& axis ) const
{
	Array<float> apt(3), ax(3);	
	int ier = cg_axisym_read( getFileID(), getID(), apt, ax );
	check_error( "Base_t::readAxiSymmetry", "cg_axisym_read", ier );
	refpt = apt;
	axis  = ax;
	return Axisymetry_t(push( "Axisymmetry_t", 1 ));
}
/*! Reads a Family_t located under this Base
 * \param index   Index of the family to read [Input]
 * \param famname Name of that family [Output]
 * \param fambc   Flag indicating if there is a FamilyBC_t associated with that Family_t [Output]
 * \param ngeoref Number of Geometry references associated with that Family_t [Output]
 * \return Handle to the Family_t structure
 * \throw cgns_notfound When the requested family index does not exist
 */
Family_t Base_t::readFamily( int index, string& famname, bool& fambc, int& ngeoref ) const
{
	cgnsstring fname;
	int nfbc, ngeo;
	int ier = cg_family_read( getFileID(), getID(), ++index, fname, &nfbc, &ngeo );
	check_found( "Base_t::readFamily", "Family_t", ier );
	check_error( "Base_t::readFamily", "cg_family_read", ier );
	famname = fname;
	fambc   = (nfbc!=0);
	ngeoref = ngeo;
	return Family_t(push( "Family_t", index ), fambc, ngeo );
}
/*! Reads information about a specified Zone_t
 * \param index     Index of zone to read
 * \param zonename  Name of that zone
 * \param nodesize  Number of nodes in each direction in structured zones, total nb. of nodes for unstructured
 * \param cellsize  Number of cells in each direction in structured zones, total nb. of cells for unstructured
 * \param bndrysize Number of boundary vertices in each direction in structured zone, total nb of boundary vertices for unstructured
 * \param type      Type of zone (Structured or Unstructured)
 * \throw cgns_notfound When the requested zone index was not found under the current base
 */
Zone_t Base_t::readZone( int index, string& zonename, vector<int>& nodesize, vector<int>& cellsize, vector<int>& bndrysize, ZoneType_t& type ) const
{
	cgnsstring zname;
	int sizedata[9]; // What is the max number of dimensions???
	int ier;
	ier = cg_zone_read( getFileID(), getID(), ++index, zname, sizedata );
	check_error( "Base_t::getZone", "cg_zone_read", ier );
	ier = cg_zone_type( getFileID(), getID(), index, &type );
	check_error( "Base_t::getZone", "cg_zone_type", ier );

	// copy to user parameters
	switch( type )
	{
	case Unstructured:
		nodesize.resize(1,sizedata[0]);
		cellsize.resize(1,sizedata[1]);
		bndrysize.resize(1,sizedata[2]);
		break;
	case Structured:
		{
		int nindexdim = getCellDimension();   // don't call get_index_dimension - 'this' is not a Zone_t!
		nodesize.resize(nindexdim);
		cellsize.resize(nindexdim);
		bndrysize.resize(0);
		for ( int i=0 ; i<nindexdim ; i++ )
			{
			nodesize[i] = sizedata[i];
			cellsize[i] = sizedata[nindexdim+i];
			}
		}
		break;
	}
	zonename = zname;
	
	structure_t s = push( "Zone_t", index );
	s.set_attribute( "ZoneType", type );
	return Zone_t(s);
	
	//return Zone_t(push("Zone_t",index));
}
/*! Writes a new Zone_t
 * \param zonename  Name of the zone
 * \param nodesize  Number of nodes in each direction in structured zones, total nb. of nodes for unstructured
 * \param cellsize  Number of cells in each direction in structured zones, total nb. of cells for unstructured
 * \param bndrysize Number of boundary vertices in each direction in structured zone, total nb of boundary vertices for unstructured
 * \param type      Type of zone (Structured or Unstructured)
 * \throw cgns_badargument When the various size vector do not make sense for the given type of zone
 */
Zone_t Base_t::writeZone( const string& zonename, const vector<int>& nodesize, const vector<int>& cellsize, const vector<int>& bndrysize, ZoneType_t type )
{
	int physdim = getPhysicalDimension(); //// HERE!!! _-_- We can't call this here file not opened for reading!!!
	int index, ier;
	if ( type == Structured )
	{
		if ( nodesize.size() != physdim || cellsize.size() != physdim || bndrysize.size() > 0 )
			throw cgns_badargument( "Base_t::writeZone", "Invalid zone sizes" );
			
		Array<int> adims(physdim*3);
		for ( int i=0 ; i<physdim ; i++ )
		{
			adims[i] = nodesize[i];
			adims[i+physdim] = cellsize[i];
			adims[i+2*physdim] = 0;
		}
		ier = cg_zone_write( getFileID(), getID(), zonename.c_str(), adims, type, &index );
	}
	else
	{
		if ( nodesize.size() != 1 || cellsize.size() != 1 || bndrysize.size() > 1 )
			throw cgns_badargument( "Base_t::writeZone", "Invalid zone sizes" );
		
		Array<int> adims(3);
		adims[0] = nodesize[0];
		adims[1] = cellsize[0];
		adims[2] = (bndrysize.size()>0) ? bndrysize[0] : 0;
		ier = cg_zone_write( getFileID(), getID(), zonename.c_str(), adims, type, &index );
	}
	check_error( "Base_t::writeZone", "cg_zone_write", ier );
	
	structure_t s = push( "Zone_t", index );
	s.set_attribute( "ZoneType", type );
	return Zone_t(s);
	//return Zone_t(push( "Zone_t", index ));
}
BaseIterativeData_t Base_t::writeBaseIterativeData( const string& name, int nsteps )
{
	int ier = cg_biter_write( getFileID(), getID(), name.c_str(), nsteps );
	check_error( "Zone_t::writeBaseIterativeData", "cg_biter_write", ier );
	return BaseIterativeData_t(push("ZoneIterativeData_t",1));
}
void Base_t::writeSimulationType( SimulationType_t s )
{
	int ier = cg_simulation_type_write( getFileID(), getID(), s );
	check_error( "Base_t::writeSimulationtype", "cg_simulation_type_write", ier );
}