コード例 #1
0
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
UAZBUS_RigidTire::UAZBUS_RigidTire(const std::string& name, bool use_mesh) : ChRigidTire(name) {
    SetContactFrictionCoefficient(0.9f);
    SetContactRestitutionCoefficient(0.1f);
    SetContactMaterialProperties(2e7f, 0.3f);
    SetContactMaterialCoefficients(2e5f, 40.0f, 2e5f, 20.0f);

    if (use_mesh) {
        SetMeshFilename(GetDataFile("uaz/uazbus_tire.obj"), 0.005);
    }
}
コード例 #2
0
ファイル: DataFileList.cpp プロジェクト: SAMAN-64/cpptraj
// TODO: Accept const ArgList so arguments are not reset?
CpptrajFile* DataFileList::AddCpptrajFile(FileName const& nameIn, 
                                          std::string const& descrip,
                                          CFtype typeIn, bool allowStdout)
{
  // If no filename and stdout not allowed, no output desired.
  if (nameIn.empty() && !allowStdout) return 0;
  FileName name;
  CpptrajFile* Current = 0;
  int currentIdx = -1;
  if (!nameIn.empty()) {
    name = nameIn;
    // Append ensemble number if set.
    if (ensembleNum_ != -1)
      name.Append( "." + integerToString(ensembleNum_) );
    // Check if filename in use by DataFile.
    DataFile* df = GetDataFile(name);
    if (df != 0) {
      mprinterr("Error: Text output file name '%s' already in use by data file '%s'.\n",
                nameIn.full(), df->DataFilename().full());
      return 0;
    }
    // Check if this filename already in use
    currentIdx = GetCpptrajFileIdx( name );
    if (currentIdx != -1) Current = cfList_[currentIdx];
  }
  // If no CpptrajFile associated with name, create new CpptrajFile
  if (Current==0) {
    switch (typeIn) {
      case TEXT: Current = new CpptrajFile(); break;
      case PDB:  Current = (CpptrajFile*)(new PDBfile()); break;
    }
    Current->SetDebug(debug_);
    // Set up file for writing. 
    //if (Current->SetupWrite( name, debug_ ))
    if (Current->OpenWrite( name ))
    {
      mprinterr("Error: Setting up text output file %s\n", name.full());
      delete Current;
      return 0;
    }
    cfList_.push_back( Current );
    cfData_.push_back( CFstruct(descrip, typeIn) );
  } else {
    // If Current type does not match typeIn do not allow.
    if (typeIn != cfData_[currentIdx].Type()) {
      mprinterr("Error: Cannot change type of text output for '%s'.\n", Current->Filename().full());
      return 0;
    }
    Current->SetDebug(debug_);
    // Update description
    if (!descrip.empty())
      cfData_[currentIdx].UpdateDescrip( descrip );
  }
  return Current;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: MagistrTot/AnimeListOld
//открытие последнего открытого файла
void AnimeList::OpenLastFile()
{
	String iniFile = GetDataFile("AnimeList.xml");
	String d = LoadFile(iniFile);
	XmlParser p(d);
	while(!p.IsTag())
		p.Skip();
	p.PassTag("FileList");
		if(p.Tag("File"))
			filename = p.ReadText();
	OpenFile();
}
コード例 #4
0
ファイル: DataFileList.cpp プロジェクト: SAMAN-64/cpptraj
/** Create new DataFile, or return existing DataFile. */
DataFile* DataFileList::AddDataFile(FileName const& nameIn, ArgList& argIn,
                                    DataFile::DataFormatType typeIn)
{
  // If no filename, no output desired
  if (nameIn.empty()) return 0;
  FileName fname( nameIn );
  // Append ensemble number if set.
  //rprintf("DEBUG: Setting up data file '%s' with ensembleNum %i\n", nameIn.base(), ensembleNum_);
  if (ensembleNum_ != -1)
    fname.Append( "." + integerToString(ensembleNum_) );
  // Check if filename in use by CpptrajFile.
  CpptrajFile* cf = GetCpptrajFile(fname);
  if (cf != 0) {
    mprinterr("Error: Data file name '%s' already in use by text output file '%s'.\n",
              fname.full(), cf->Filename().full());
    return 0;
  }
  // Check if this filename already in use
  DataFile* Current = GetDataFile(fname);
  // If no DataFile associated with name, create new DataFile
  if (Current==0) {
    Current = new DataFile();
    if (Current->SetupDatafile(fname, argIn, typeIn, debug_)) {
      mprinterr("Error: Setting up data file %s\n", fname.full());
      delete Current;
      return 0;
    }
    fileList_.push_back(Current);
  } else {
    // Set debug level
    Current->SetDebug(debug_);
    // If a type was specified, make sure it matches.
    if (typeIn != DataFile::UNKNOWN_DATA && typeIn != Current->Type()) {
      mprinterr("Error: '%s' is type %s but has been requested as type %s.\n",
                Current->DataFilename().full(), Current->FormatString(),
                DataFile::FormatString( typeIn ));
      return 0;
    }
    // Check for keywords that do not match file type
    DataFile::DataFormatType kType = DataFile::GetFormatFromArg( argIn );
    if (kType != DataFile::UNKNOWN_DATA && kType != Current->Type())
      mprintf("Warning: %s is type %s but type %s keyword specified; ignoring keyword.\n",
              Current->DataFilename().full(), Current->FormatString(),
              DataFile::FormatString( kType ));
    // Process Arguments
    if (!argIn.empty())
      Current->ProcessArgs( argIn );
  }
  return Current;
}
コード例 #5
0
ファイル: FEATire.cpp プロジェクト: projectchrono/chrono
// -----------------------------------------------------------------------------
// Create the FEA mesh
// -----------------------------------------------------------------------------
void FEATire::CreateMesh(const ChFrameMoving<>& wheel_frame, VehicleSide side) {
    //// TODO:
    ////    Currently, we assume that the INP file contains a tire with rotation axis along X
    ChMeshFileLoader::FromAbaqusFile(m_mesh, GetDataFile(m_input_file).c_str(), m_material, m_node_sets,
                                     wheel_frame.GetPos(),
                                     wheel_frame.GetA() * ChMatrix33<>(CH_C_PI_2, ChVector<>(0, 0, 1)));

    for (unsigned int i = 0; i < m_mesh->GetNnodes(); i++) {
        auto node = std::dynamic_pointer_cast<ChNodeFEAxyz>(m_mesh->GetNode(i));
        // Node position (expressed in wheel frame)
        ChVector<> loc = wheel_frame.TransformPointParentToLocal(node->GetPos());
        // Node velocity (expressed in absolute frame)
        ChVector<> vel = wheel_frame.PointSpeedLocalToParent(loc);
        node->SetPos_dt(vel);
    }
}
コード例 #6
0
ファイル: BinaryFile.cpp プロジェクト: fatmingwang/FM79979
	//push data into e_pDestData
	void*	cBinaryFile::GetDataFileSegment(UINT e_uiStart,UINT e_uiSLength,void*e_pDestData)
	{
	#ifdef WIN32
		fpos_t pos = e_uiStart;
		fsetpos(m_pFile,&pos);
		fread(e_pDestData,sizeof(BYTE),e_uiSLength,m_pFile);
		rewind(m_pFile);
		return e_pDestData;
	#else
			//or just indtead by pos.__pos = e_uiStart;
		//and call as win32
			unsigned short*l_pData = (unsigned short*)GetDataFile(e_uiStart);
			wchar_t*l_Transto2Wchar = (wchar_t*)e_pDestData;        
			for(int i=0;i<e_uiSLength/2;++i )
			{
				l_Transto2Wchar[i] = l_pData[i];
			}
			l_Transto2Wchar[e_uiSLength/2] = L'\0';
		return e_pDestData;
	#endif
	}
コード例 #7
0
ファイル: DataFileList.cpp プロジェクト: SAMAN-64/cpptraj
/** Process command relating to data files. */
int DataFileList::ProcessDataFileArgs(ArgList& dataArg) {
  // Next string is DataFile name that command will be passed to.
  std::string df_cmd = dataArg.GetStringNext();
  if (df_cmd.empty()) {
    mprintf("Warning: datafile: No filename given.\n");
    return 0;
  }
  // Check for deprecated commands
  if (df_cmd == "create" || df_cmd == "precision") 
    mprintf("Warning: 'datafile %s' is deprecated; use %s instead.\n", 
            df_cmd.c_str(), df_cmd.c_str());
  //mprintf("  [%s]\n",(*dataArg).ArgLine());
  DataFile* df = GetDataFile( df_cmd.c_str() );
  if (df == 0) {
    mprinterr("Error: datafile: File %s not found.\n", df_cmd.c_str());
    return 1;
  }
  // Process command
  int err = df->ProcessArgs( dataArg );
  if (err != 0 || dataArg.CheckForMoreArgs()) return 1;
  return 0;
}
コード例 #8
0
ファイル: main.cpp プロジェクト: MagistrTot/AnimeListOld
//открытие файла после выбора его в системе
void AnimeList::OpenFile()
{
	mainArray.Clear();
	listName.Clear();
	try {
			String d = LoadFile(filename);
			XmlParser p(d);
			while(!p.IsTag())
				p.Skip();
			p.PassTag("ListView");
			while(!p.IsEof()) {
				if(p.Tag("item")) {
					while(!p.End()) {
						if(p.Tag("complete"))
						{
							String complete = p.ReadText();
							if(complete == "Yes")
							   cell.complete = "Yes";
							else
								if(complete == "No")
									cell.complete = "No";
								else cell.complete = "New";
						}
						else
						if(p.Tag("name"))
							cell.name = p.ReadText();
						else
						if(p.Tag("russian"))
							cell.nameRus = p.ReadText();
						else
						if(p.Tag("episodes"))
							cell.episodes = StrInt(p.ReadText());
						else
						if(p.Tag("views"))
							cell.views = StrInt(p.ReadText());
						else
						if(p.Tag("Release"))
							StrToDate(cell.Release, p.ReadText());
						else
						if(p.Tag("series"))
							cell.releaseDate = p.ReadText();
						else {
							p.Skip();
							continue;
						}
						p.PassEnd();
					}
					mainArray.Add(cell);
					listName.Add(cell.complete, cell.name, cell.nameRus, cell.episodes, cell.views, cell.Release, cell.releaseDate, mainArray.GetCount() - 1);
					RowColor(listName.GetCount()-1);
				}
				else 
					p.Skip();
			}
		}
		catch(XmlError) {
			Exclamation("Error Readong the Input File");
		} 
		
	SetupYears();
	
	Title("Anime List | " + filename);
		
	String iniFile;
	iniFile = GetDataFile("AnimeList.xml");
	String xmlIni;
	xmlIni <<
			XmlTag("File").Text(AsString(filename));
	SaveFile(iniFile, XmlDoc("FileList", xmlIni));
	
	status.Set(Format("Items: %d. List Open", listName.GetCount()));
}
コード例 #9
0
ファイル: DrawText.cpp プロジェクト: AbdelghaniDr/mirror
void OpenGLFont::Parse(const char* xml, bool parsePages)
{
	chars.SetCount(512);
	
	XmlParser p(xml);

	while(!p.IsTag())
		p.Skip();

	p.PassTag("font");
	
	while(!p.End())
	{
		if(p.TagE("common"))
		{
			scaleW = (float) p.Double("scaleW");
			scaleH = (float) p.Double("scaleH");
			lineHeight = (float) p.Double("lineHeight");
			base = (float) p.Double("base");
		}
		else if(p.Tag("pages"))
		{
			while(!p.End())
			{
				if(p.TagE("page"))
				{
					if(parsePages)
					{
						String fileName = p["file"];
						Image img = StreamRaster::LoadFileAny(GetDataFile(fileName));
						images.Add(img);
						if(preload)
							resources.Add(img, true);
					}
					pages.Add(StrInt(p["id"]));
				}
				else
					p.Skip();
			}
			
		}
		else if(p.Tag("chars"))
		{
			while(!p.End())
			{
				if(p.TagE("char"))
				{
					int id = p.Int("id");
					CharInfo& ci = chars[id];
					
					ci.id = id;
					ci.x = (float) p.Double("x");
					ci.y = (float) p.Double("y");
					ci.width = (float) p.Double("width");
					ci.height = (float) p.Double("height");
					ci.xoffset = (float) p.Double("xoffset");
					ci.yoffset = (float) p.Double("yoffset");
					ci.xadvance = (float) p.Double("xadvance");
					ci.page = p.Int("page");
				}
				else
					p.Skip();
			}
		}
		else if(p.Tag("kernings"))
		{
			while(!p.End())
			{
				if(p.TagE("kerning"))
				{
					int first = p.Int("first"); 
					int second = p.Int("second");
					float amount = (float) p.Double("amount");
					
					VectorMap<int, float>& vm = kerns.GetAdd(first);
					vm.Add(second, amount);
				}
				else
					p.Skip();
			}
		}		
		else
			p.Skip();
	}
}
コード例 #10
0
ファイル: DrawText.cpp プロジェクト: AbdelghaniDr/mirror
void OpenGLFont::Load(const String& fileName, bool preload)
{
	String filePath = GetDataFile(fileName);
	String xml = LoadFile(filePath);
	Parse(xml, true);
}