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


C++ word函数代码示例

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


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

示例1: thermoTypeDict

Foam::autoPtr<ChemistryModel> Foam::basicChemistryModel::New
(
    const fvMesh& mesh
)
{
    IOdictionary chemistryDict
    (
        IOobject
        (
            "chemistryProperties",
            mesh.time().constant(),
            mesh,
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    word chemistryTypeName;

    if (chemistryDict.isDict("chemistryType"))
    {
        const dictionary& chemistryTypeDict
        (
            chemistryDict.subDict("chemistryType")
        );

        Info<< "Selecting chemistry type " << chemistryTypeDict << endl;

        const int nCmpt = 8;
        const char* cmptNames[nCmpt] =
        {
            "chemistrySolver",
            "chemistryModel",
            "chemistryThermo",
            "transport",
            "thermo",
            "equationOfState",
            "specie",
            "energy"
        };

        IOdictionary thermoDict
        (
            IOobject
            (
                "thermophysicalProperties",
                mesh.time().constant(),
                mesh,
                IOobject::MUST_READ_IF_MODIFIED,
                IOobject::NO_WRITE,
                false
            )
        );

        word thermoTypeName;

        if (thermoDict.isDict("thermoType"))
        {
            const dictionary& thermoTypeDict(thermoDict.subDict("thermoType"));
            thermoTypeName =
                word(thermoTypeDict.lookup("transport")) + '<'
              + word(thermoTypeDict.lookup("thermo")) + '<'
              + word(thermoTypeDict.lookup("equationOfState")) + '<'
              + word(thermoTypeDict.lookup("specie")) + ">>,"
              + word(thermoTypeDict.lookup("energy")) + ">";
        }
        else
        {
             FatalIOErrorIn
             (
                 (ChemistryModel::typeName + "::New(const mesh&)").c_str(),
                 thermoDict
             )   << "thermoType is in the old format and must be upgraded"
                 << exit(FatalIOError);
        }

        Switch isTDAC(chemistryTypeDict.lookupOrDefault("TDAC",false));

        // Construct the name of the chemistry type from the components
        if (isTDAC)
        {
            chemistryTypeName =
                word(chemistryTypeDict.lookup("chemistrySolver")) + '<'
              + "TDACChemistryModel<"
              + word(chemistryTypeDict.lookup("chemistryThermo")) + ','
              + thermoTypeName + ">>";
        }
        else
        {
            chemistryTypeName =
                word(chemistryTypeDict.lookup("chemistrySolver")) + '<'
              + "chemistryModel<"
              + word(chemistryTypeDict.lookup("chemistryThermo")) + ','
              + thermoTypeName + ">>";
        }
        typename ChemistryModel::fvMeshConstructorTable::iterator cstrIter =
            ChemistryModel::fvMeshConstructorTablePtr_->find(chemistryTypeName);

        if (cstrIter == ChemistryModel::fvMeshConstructorTablePtr_->end())
//.........这里部分代码省略.........
开发者ID:fcontino,项目名称:OpenFOAM-2.3.x,代码行数:101,代码来源:basicChemistryModelTemplates.C

示例2: word_jump

	void word_jump(cell word_) {
		gc_root<word> word(word_,parent);
		literal(tag_fixnum(xt_tail_pic_offset));
		literal(word.value());
		emit(parent->userenv[JIT_WORD_JUMP]);
	}
开发者ID:azteca,项目名称:factor,代码行数:6,代码来源:jit.hpp

示例3: word

HugeNumber operator + ( HugeNumber &u, HugeNumber &v)
// Slogenie neotrisatelnix selix chisel
{
	word j;
	dword k; // Cifra perenosa
	word uk; // Chislo razriadov u
	word vk; // Chislo razriadov v
	word wk; // Chislo razriadov w
	word kw;
	dword p;
	HugeNumber w; // Zdes bydem nakaplivat rezyltat

	vk=v.Razr();
	uk=u.Razr();
	wk=wmax(uk,vk);
	kw=wmin(uk,vk);
	w.Resize(wk+1);	// Delaem nygnyiy razriadnost rezyltata

	k=0;
	// Symiryem razriadi po samomy korotkomy chisly
	for (j=0; j<kw; j++)
	{
		p=dword(u.digit[j])+dword(v.digit[j])+k;
		if (p>=base)
		{
			k=1;
			w.digit[j] = word(p & (base-1));
		}
		else
		{
			k=0;
			w.digit[j]= word(p);
		};
	};

	// Tiper nado prosymirovat ostavshiesia razriadi dlinnogo chisla i
	// razriad perenosa.
	if (k!=0)
	{	// Bil perenos pri symmirovanii po korotkomy chisly
		// Nado symmirivat ostavshiesia razriady
		if (uk>vk)
		{
			// Symmiryem, poka est cifra perenosa
			for (; j<uk; j++)
			{
				p=u.digit[j]+k;
				if (p>=base)
				{
					k=1;
      			w.digit[j] = word(p & (base-1));
				}
				else
				{
					k=0;
					w.digit[j]= word(p);
					break;
				};
			}
			// Kopiryem ostavshiesia razriady
			if (k==0) for (j++; j<uk; j++) w.digit[j]=u.digit[j];
		}
		else
		{
			// Symmiryem, poka est cifra perenosa
			for (; j<vk; j++)
			{
				p=v.digit[j]+k;
				w.digit[j]= word(p & (base-1));
				if (p>=base)
				{
					k=1;
				}
				else
				{
					k=0;
					break;
				};
			}
			// Kopiryem ostavshiesia razriady
			if (k==0) for (j++; j<vk; j++) w.digit[j]=v.digit[j];
		};
		if (k!=0)
		{	// Symmirovanie provedeno po vsem razriadam, no eshe est
			// cifra perenosa
			w.digit[j]=word(k);
		}
	}
	else
	{	// Nebilo perenosa pri symmirovanii po korotkomy chisly
		// Nado prosto skopirovat ostavshiesia razriady dlinnogo chisla
		if (vk>uk)
			for (; j<vk; j++)
				w.digit[j]=v.digit[j];
		else
			if (uk>vk)
				for (; j<uk; j++)
					w.digit[j]=word(u.digit[j]+k);
	};
	return w;
};
开发者ID:HippoRemote,项目名称:MacHippoVNC,代码行数:100,代码来源:Hnumber.cpp

示例4: ModbusGetUserCommandAdditional3

 uint16_t ModbusGetUserCommandAdditional3()
 {
     return word(ModbusUserCommandAdditional3Hi, ModbusUserCommandAdditional3Lo);
 }
开发者ID:Reddds,项目名称:BOLID-C2000-BI,代码行数:4,代码来源:ModbusRtu.c

示例5:

void PolynomialMod2::SetByte(size_t n, byte value)
{
	reg.CleanGrow(BytesToWords(n+1));
	reg[n/WORD_SIZE] &= ~(word(0xff) << 8*(n%WORD_SIZE));
	reg[n/WORD_SIZE] |= (word(value) << 8*(n%WORD_SIZE));
}
开发者ID:prakhs123,项目名称:cryptopp,代码行数:6,代码来源:gf2n.cpp

示例6: ntpSync

void ntpSync()
{
  const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message
  byte packetBuffer[ NTP_PACKET_SIZE]; //buffer to hold incoming and outgoing packets
  int pos;
  unsigned long timeout;
  time_t utc, local;
  TimeChangeRule *tcr;

  memset(packetBuffer, 0, NTP_PACKET_SIZE);
  // Initialize values needed to form NTP request
  // (see URL above for details on the packets)
  //Serial.println("2");
  packetBuffer[0] = 0b11100011;   // LI, Version, Mode
  packetBuffer[1] = 0;     // Stratum, or type of clock
  packetBuffer[2] = 6;     // Polling Interval
  packetBuffer[3] = 0xEC;  // Peer Clock Precision
  // 8 bytes of zero for Root Delay & Root Dispersion
  packetBuffer[12]  = 49;
  packetBuffer[13]  = 0x4E;
  packetBuffer[14]  = 49;
  packetBuffer[15]  = 52;

  altSerial.println("AT+CIPSTART=1,\"UDP\",\"192.168.10.253\",123");
  if (!waitforLine("OK", 2000)) {
    Serial.println("Unable to connect to NTP server");
    return;
  }
  altSerial.println("AT+CIPSEND=1,48");
  if (!waitforString(">", 1000)) {
    Serial.println("Prompt missed");
    return;
  }

  Serial.println("Sending query");
  altSerial.write(packetBuffer, NTP_PACKET_SIZE);
  if (!waitforString("+IPD,1,48:", 2000)) {
    Serial.println("NTP Server did not respond");
    return;
  }

  pos = 0;
  timeout = millis() + 1000;
  memset(packetBuffer, 0, NTP_PACKET_SIZE);

  while ((pos < NTP_PACKET_SIZE) && (millis() < timeout)) {
    if (altSerial.available() > 0)
      packetBuffer[pos++] = altSerial.read();
  }

  if (!waitforLine("SEND OK", 2000)) {
    Serial.println("Failed to send?");
  }

  altSerial.println("AT+CIPCLOSE=1");
  if (!waitforLine("OK", 2000)) {
    Serial.println("Unable to close port");
    return;
  }  

  // Serial.print("Bytes received: ");
  // Serial.println(pos);

  unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
  unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
  // combine the four bytes (two words) into a long integer
  // this is NTP time (seconds since Jan 1 1900):
  unsigned long secsSince1900 = highWord << 16 | lowWord;
  // Serial.print("Seconds since Jan 1 1900 = " );
  // Serial.println(secsSince1900);

  // now convert NTP time into everyday time:
  // Serial.print("Unix time = ");
  // Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
  const unsigned long seventyYears = 2208988800UL;
  // subtract seventy years:
  unsigned long epoch = secsSince1900 - seventyYears;
  // print Unix time:
  // Serial.println(epoch);
  setTime(epoch);

  utc = now();
  printTime(utc, "UTC");
  local = myTZ.toLocal(utc, &tcr);
  printTime(local, tcr -> abbrev);
}
开发者ID:FrauBluher,项目名称:ShR2,代码行数:86,代码来源:ardiuno_esptime.c

示例7: getWindow

void TextPreview::drawTextArea(QPainter *painter)
{
	useTimer = false;

	if(ff8Text.isEmpty())	return;

	bool jp = font->tableCount() == 4;
	FF8Window ff8Window = getWindow();

	/* Window Background */

	if(ff8Window.type!=NOWIN) {
		painter->translate(realPos(ff8Window));
	}

	painter->setBrush(QPixmap(":/images/menu-fond.png"));

	/* Frame */
	QPen pen(QColor(41,41,41));
	pen.setWidth(1);
	pen.setJoinStyle(Qt::MiterJoin);
	painter->setPen(pen);
	painter->drawRect(0, 0, maxW, maxH);

	painter->setPen(QColor(132,132,132));
	painter->drawLine(2, 1, maxW-2, 1);
	painter->drawLine(1, 2, 1, maxH-2);

	painter->setPen(QColor(58,58,58));
	painter->drawLine(2, maxH-1, maxW-1, maxH-1);
	painter->drawLine(maxW-1, 2, maxW-1, maxH-2);

	painter->setPen(QColor(99,99,99));
	painter->drawPoint(1, 1);

	painter->setPen(QColor(82,82,82));
	painter->drawPoint(maxW-1, 1);
	painter->drawPoint(1, maxH-1);

	int ask_first=-1, ask_last=-1;

	if(ff8Window.type==0x6f) {
		ask_first = ff8Window.ask_first;
		ask_last = ff8Window.ask_last;
		if(ask_last >= ask_first)
			painter->drawPixmap(10, 11+16*ask_first, QPixmap(":/images/cursor.png"));
	}

	/* Text */

	fontColor = TdwFile::White;

	int charId, line=0, x = (ask_first==0 && ask_last>=0 ? 40 : 8), y = 8;
	int start = pagesPos.value(currentPage, 0), size = ff8Text.size();

	for(int i=start ; i<size ; ++i)
	{
		charId = (quint8)ff8Text.at(i);

		if(charId>=32)
		{
			if(jp) {
				letter(&x, &y, charId-32, painter);// 210-32
			} else {
				if(charId<227) {
					letter(&x, &y, charId-32, painter);
				} else if(charId>=232) {
					letter(&x, &y, optimisedDuo[charId-232][0], painter);
					letter(&x, &y, optimisedDuo[charId-232][1], painter);
				}
			}
		}
		else if(charId<=1)//NewPage
			break;
		else if(charId==2)//\n
		{
			++line;
			x = (ask_first<=line && ask_last>=line ? 40 : 8);
			y += 16;
		}
		else if(charId<32)
		{
			++i;
			switch(charId)
			{
			case 0x03: // Character names
				charId = (quint8)ff8Text.at(i);

				if(charId>=0x30 && charId<=0x3a)
					word(&x, &y, names.at(charId-0x30), painter, 5);
				else if(charId==0x40)
					word(&x, &y, names.at(11), painter, 5);
				else if(charId==0x50)
					word(&x, &y, names.at(12), painter, 5);
				else if(charId==0x60)
					word(&x, &y, names.at(13), painter, 5);
				break;
			case 0x04:// Var
				charId = (quint8)ff8Text.at(i);

//.........这里部分代码省略.........
开发者ID:JeMaCheHi,项目名称:deling,代码行数:101,代码来源:TextPreview.cpp

示例8: searchableSurface

Foam::binaryOperationSearchableSurface::binaryOperationSearchableSurface
(
    const IOobject& io,
    const dictionary& dict
)
:
    searchableSurface(io),
    aName_(dict.lookupOrDefault<word>("aName","A")),
    bName_(dict.lookupOrDefault<word>("bName","B")),
    a_(
        searchableSurface::New
        (
            word(dict.subDict("a").lookup("type")),
            IOobject(
                name()+"_"+word(dict.lookup("type"))+"_"+aName_,
                io.instance(),
                io.db(),
                io.readOpt(),
                io.writeOpt()
            ),
            dict.subDict("a")
        )
    ),
    b_(
        searchableSurface::New
        (
            word(dict.subDict("b").lookup("type")),
            IOobject(
                name()+"_"+word(dict.lookup("type"))+"_"+bName_,
                io.instance(),
                io.db(),
                io.readOpt(),
                io.writeOpt()
            ),
            dict.subDict("b")
        )
    ),
    nrARegions_(
        a().regions().size()
    ),
    nrBRegions_(
        b().regions().size()
    )
{
    if(aName_==bName_) {
        FatalErrorIn("binaryOperationSearchableSurface::binaryOperationSearchableSurface")
            << "'aName' and 'bName' have the same value " << aName_
                << " for " << name()
                << endl
                << exit(FatalError);
    }
    if(regions().size()!=size()) {
        FatalErrorIn("binaryOperationSearchableSurface::binaryOperationSearchableSurface")
            << "Number of regions " << regions().size() << " not equal to size "
                << size() << nl << "Regions: " << regions()
                << endl
                << exit(FatalError);

    }

#ifdef FOAM_SEARCHABLE_SURF_HAS_BOUND_METHOD
    pointField pts(4);
    pts[0]=a().bounds().min();
    pts[1]=a().bounds().max();
    pts[2]=b().bounds().min();
    pts[3]=b().bounds().max();
    bounds()=boundBox(pts);
#endif
}
开发者ID:Unofficial-Extend-Project-Mirror,项目名称:openfoam-extend-swak4Foam-dev,代码行数:69,代码来源:binaryOperationSearchableSurface.C

示例9: lineNumber

Foam::Istream& Foam::UIPstream::read(token& t)
{
    // Return the put back token if it exists
    if (Istream::getBack(t))
    {
        return *this;
    }

    char c;

    // return on error
    if (!read(c))
    {
        t.setBad();
        return *this;
    }

    // Set the line number of this token to the current stream line number
    t.lineNumber() = lineNumber();

    // Analyse input starting with this character.
    switch (c)
    {
        // Punctuation
        case token::END_STATEMENT :
        case token::BEGIN_LIST :
        case token::END_LIST :
        case token::BEGIN_SQR :
        case token::END_SQR :
        case token::BEGIN_BLOCK :
        case token::END_BLOCK :
        case token::COLON :
        case token::COMMA :
        case token::ASSIGN :
        case token::ADD :
        case token::SUBTRACT :
        case token::MULTIPLY :
        case token::DIVIDE :
        {
            t = token::punctuationToken(c);
            return *this;
        }

        // Word
        case token::WORD :
        {
            word* pval = new word;
            if (read(*pval))
            {
                if (token::compound::isCompound(*pval))
                {
                    t = token::compound::New(*pval, *this).ptr();
                    delete pval;
                }
                else
                {
                    t = pval;
                }
            }
            else
            {
                delete pval;
                t.setBad();
            }
            return *this;
        }

        // String
        case token::VERBATIMSTRING :
        {
            // Recurse to read actual string
            read(t);
            t.type() = token::VERBATIMSTRING;
            return *this;
        }
        case token::VARIABLE :
        {
            // Recurse to read actual string
            read(t);
            t.type() = token::VARIABLE;
            return *this;
        }
        case token::STRING :
        {
            string* pval = new string;
            if (read(*pval))
            {
                t = pval;
                if (c == token::VERBATIMSTRING)
                {
                    t.type() = token::VERBATIMSTRING;
                }
            }
            else
            {
                delete pval;
                t.setBad();
            }
            return *this;
        }
//.........这里部分代码省略.........
开发者ID:OlegSutyrin,项目名称:OpenFOAM-3.0.x,代码行数:101,代码来源:UIPstream.C

示例10: names_

Foam::searchableSurfaces::searchableSurfaces
(
    const IOobject& io,
    const dictionary& topDict
)
:
    PtrList<searchableSurface>(topDict.size()),
    names_(topDict.size()),
    regionNames_(topDict.size()),
    allSurfaces_(identity(topDict.size()))
{
    label surfI = 0;
    forAllConstIter(dictionary, topDict, iter)
    {
        const word& key = iter().keyword();

        if (!topDict.isDict(key))
        {
            FatalErrorIn
            (
                "searchableSurfaces::searchableSurfaces"
                "( const IOobject&, const dictionary&)"
            )   << "Found non-dictionary entry " << iter()
                << " in top-level dictionary " << topDict
                << exit(FatalError);
        }

        const dictionary& dict = topDict.subDict(key);

        names_[surfI] = key;
        dict.readIfPresent("name", names_[surfI]);

        // Make IOobject with correct name
        autoPtr<IOobject> namedIO(io.clone());
        // Note: we would like to e.g. register triSurface 'sphere.stl' as
        // 'sphere'. Unfortunately
        // no support for having object read from different location than
        // their object name. Maybe have stlTriSurfaceMesh which appends .stl
        // when reading/writing?
        namedIO().rename(key);  // names_[surfI]

        // Create and hook surface
        set
        (
            surfI,
            searchableSurface::New
            (
                dict.lookup("type"),
                namedIO(),
                dict
            )
        );
        const searchableSurface& s = operator[](surfI);

        // Construct default region names by prepending surface name
        // to region name.
        const wordList& localNames = s.regions();

        wordList& rNames = regionNames_[surfI];
        rNames.setSize(localNames.size());

        forAll(localNames, regionI)
        {
            rNames[regionI] = names_[surfI] + '_' + localNames[regionI];
        }

        // See if dictionary provides any global region names.
        if (dict.found("regions"))
        {
            const dictionary& regionsDict = dict.subDict("regions");

            forAllConstIter(dictionary, regionsDict, iter)
            {
                const word& key = iter().keyword();

                if (regionsDict.isDict(key))
                {
                    // Get the dictionary for region iter.keyword()
                    const dictionary& regionDict = regionsDict.subDict(key);

                    label index = findIndex(localNames, key);

                    if (index == -1)
                    {
                        FatalErrorIn
                        (
                            "searchableSurfaces::searchableSurfaces"
                            "( const IOobject&, const dictionary&)"
                        )   << "Unknown region name " << key
                            << " for surface " << s.name() << endl
                            << "Valid region names are " << localNames
                            << exit(FatalError);
                    }

                    rNames[index] = word(regionDict.lookup("name"));
                }
            }
        }

        surfI++;
//.........这里部分代码省略.........
开发者ID:0184561,项目名称:OpenFOAM-2.1.x,代码行数:101,代码来源:searchableSurfaces.C

示例11: getParameter

void contentTypeField::setBoundary(const string& boundary)
{
	getParameter("boundary")->setValue(word(boundary, vmime::charsets::US_ASCII));
}
开发者ID:0xd34df00d,项目名称:vmime,代码行数:4,代码来源:contentTypeField.cpp

示例12: BlockMeshManager

TerrainManager::TerrainManager(
		const Time & runTime,
		const dictionary & dict,
		const searchableSurface * const stl_
		):
		BlockMeshManager(runTime),
		stl_(stl_),
		blockNrs_(dict.lookup("blocks")),
		cellNrs_(dict.lookup("cells")),
		domainBox_
		(
				CoordinateSystem
				(
						point(dict.lookup("p_corner")),
						List< Foam::vector >(dict.subDict("coordinates").lookup("baseVectors"))
				),
				scalarList(dict.lookup("dimensions")),
				dict.lookupOrDefault< scalar >("boxResolution",0.0001)
		),
		stlBox_(domainBox_),
		splineNormalDist_(0),
		mode_upwardSplines_(0),
		zeroLevel_(0),
		gradingFactors_(dict.lookup("gradingFactors")),
		cylinderModule_(this),
		modificationModule_(this),
		gradingModule_(this),
		blendingFunction_
		(
				new ScalarBlendingFunction()
		){

	// Read dictionary:
	p_above_     = point(dict.lookup("p_above"));
	maxDistProj_ = readScalar(dict.lookup("maxDistProj"));

	// option for stl_ inside the domain box:
	if(dict.found("stlInsideBox")){
		if(dict.subDict("stlInsideBox").found("zeroLevel")){
			zeroLevel_ = readScalar(dict.subDict("stlInsideBox").lookup("zeroLevel"));
		}
		stlBox_ = Box
		(
				CoordinateSystem
				(
						point(dict.subDict("stlInsideBox").lookup("p_corner_inside_stl")),
						coordinateSystem().axes()
				),
				scalarList(dict.subDict("stlInsideBox").lookup("dimensions_inside_stl")),
				dict.subDict("stlInsideBox").lookupOrDefault< scalar >("boxResolution",0.0001)
		);
		blendingFunction_ =
				ScalarBlendingFunction::New
				(
					dict.subDict("stlInsideBox").subDict("blendingFunction")
				);
		if(dict.subDict("stlInsideBox").subDict("blendingFunction").found("writePDF")){
			const dictionary & writeDict = dict.subDict("stlInsideBox").subDict("blendingFunction").subDict("writePDF");
			blendingFunction_().writePDFs
			(
					word(writeDict.lookup("baseName")),
					fileName(writeDict.lookup("resultsFolder")),
					point(writeDict.lookup("probePoint0")),
					point(writeDict.lookup("probePoint1")),
					0,1,
					readLabel(writeDict.lookup("steps")),
					readLabel(writeDict.lookup("plotPoints")),
					readLabel(writeDict.lookup("interpolOrder"))
			);
		} else {
			Info << "TerrainManager: keyword 'writePDF' not found in sub dictionary 'blendingFunction'." << endl;
		}
	}

    // module orography modifications:
    if(dict.found("terrainModification")){
    	Info << "   loading orography modification module" << endl;
    	if(!modificationModule_.load(dict.subDict("terrainModification"))){
    		Info << "\n   TerrainManager: Error while loading orography modification module." << endl;
    		throw;
    	}
    }

    // module block grading:
    if(dict.found("blockGrading")){
    	Info << "   loading block grading module" << endl;
    	if(!gradingModule_.load(dict.subDict("blockGrading"))){
    		Info << "\n   TerrainManager: Error while loading block grading module." << endl;
    		throw;
    	}
    }

    // module outer cylinder:
    if(dict.found("outerCylinder")){
    	Info << "   loading cylinder module" << endl;
    	if(!cylinderModule_.load(dict.subDict("outerCylinder"))){
    		Info << "\n   TerrainManager: Error while loading cylinder module." << endl;
    		throw;
    	}
    }
//.........这里部分代码省略.........
开发者ID:acimpoeru,项目名称:terrainBlockMesher,代码行数:101,代码来源:TerrainManager.C

示例13: getasciilabel

/*
 * Read an ascii label in from fd f,
 * in the same format as that put out by display(),
 * and fill in lp.
 */
static int
getasciilabel(FILE *f, struct disklabel *lp)
{
	char *cp, *endp;
	const char **cpp;
	u_int part;
	char *tp, line[BUFSIZ];
	u_long v;
	int lineno = 0, errors = 0;
	int i;

	makelabel("auto", lp);
	bzero(&part_set, sizeof(part_set));
	bzero(&part_size_type, sizeof(part_size_type));
	bzero(&part_offset_type, sizeof(part_offset_type));
	lp->d_bbsize = BBSIZE;				/* XXX */
	lp->d_sbsize = 0;				/* XXX */
	while (fgets(line, sizeof(line) - 1, f)) {
		lineno++;
		if ((cp = strchr(line,'\n')) != 0)
			*cp = '\0';
		cp = skip(line);
		if (cp == NULL)
			continue;
		tp = strchr(cp, ':');
		if (tp == NULL) {
			fprintf(stderr, "line %d: syntax error\n", lineno);
			errors++;
			continue;
		}
		*tp++ = '\0', tp = skip(tp);
		if (!strcmp(cp, "type")) {
			if (tp == NULL)
				tp = unknown;
			cpp = dktypenames;
			for (; cpp < &dktypenames[DKMAXTYPES]; cpp++)
				if (*cpp && !strcmp(*cpp, tp)) {
					lp->d_type = cpp - dktypenames;
					break;
				}
			if (cpp < &dktypenames[DKMAXTYPES])
				continue;
			errno = 0;
			v = strtoul(tp, &endp, 10);
			if (errno != 0 || *endp != '\0')
				v = DKMAXTYPES;
			if (v >= DKMAXTYPES)
				fprintf(stderr, "line %d:%s %lu\n", lineno,
				    "Warning, unknown disk type", v);
			else
				lp->d_type = v;
			continue;
		}
		if (!strcmp(cp, "flags")) {
			for (v = 0; (cp = tp) && *cp != '\0';) {
				tp = word(cp);
				if (!strcmp(cp, "removeable"))
					v |= D_REMOVABLE;
				else if (!strcmp(cp, "ecc"))
					v |= D_ECC;
				else if (!strcmp(cp, "badsect"))
					v |= D_BADSECT;
				else {
					fprintf(stderr,
					    "line %d: %s: bad flag\n",
					    lineno, cp);
					errors++;
				}
			}
			lp->d_flags = v;
			continue;
		}
		if (!strcmp(cp, "drivedata")) {
			for (i = 0; (cp = tp) && *cp != '\0' && i < NDDATA;) {
				lp->d_drivedata[i++] = strtoul(cp, NULL, 10);
				tp = word(cp);
			}
			continue;
		}
		if (sscanf(cp, "%lu partitions", &v) == 1) {
			if (v > MAXPARTITIONS) {
				fprintf(stderr,
				    "line %d: bad # of partitions\n", lineno);
				lp->d_npartitions = MAXPARTITIONS;
				errors++;
			} else if (v < DEFPARTITIONS) {
				fprintf(stderr,
				    "line %d: bad # of partitions\n", lineno);
				lp->d_npartitions = DEFPARTITIONS;
				errors++;
			} else
				lp->d_npartitions = v;
			continue;
		}
		if (tp == NULL)
//.........这里部分代码省略.........
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:101,代码来源:bsdlabel.c

示例14: libNames

Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
{
    wordList libNames(1);
    libNames[0]=word("mesquiteMotionSolver");

    forAll(libNames,i) {
        const word libName("lib"+libNames[i]+".so");

        bool ok=dlLibraryTable::open(libName);
        if(!ok) {
            WarningIn("dynamicFvMesh::New(const IOobject& io)")
                << "Loading of dynamic mesh library " << libName
                    << " unsuccesful. Some dynamic mesh  methods may not be "
                    << " available"
                    << endl;
        }
    }

    // Enclose the creation of the dynamicMesh to ensure it is
    // deleted before the dynamicFvMesh is created otherwise the dictionary
    // is entered in the database twice
    IOdictionary dynamicMeshDict
    (
        IOobject
        (
            "dynamicMeshDict",
            io.time().constant(),
            (io.name() == dynamicFvMesh::defaultRegion ? "" : io.name() ),
            io.db(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    word dynamicFvMeshTypeName(dynamicMeshDict.lookup("dynamicFvMesh"));

    Info<< "Selecting dynamicFvMesh " << dynamicFvMeshTypeName << endl;

    dlLibraryTable::open
    (
        dynamicMeshDict,
        "dynamicFvMeshLibs",
        IOobjectConstructorTablePtr_
    );

    if (!IOobjectConstructorTablePtr_)
    {
        FatalErrorIn
        (
            "dynamicFvMesh::New(const IOobject&)"
        )   << "dynamicFvMesh table is empty"
            << exit(FatalError);
    }

    IOobjectConstructorTable::iterator cstrIter =
        IOobjectConstructorTablePtr_->find(dynamicFvMeshTypeName);

    if (cstrIter == IOobjectConstructorTablePtr_->end())
    {
        FatalErrorIn
        (
            "dynamicFvMesh::New(const IOobject&)"
        )   << "Unknown dynamicFvMesh type " << dynamicFvMeshTypeName
            << endl << endl
            << "Valid dynamicFvMesh types are :" << endl
            << IOobjectConstructorTablePtr_->toc()
            << exit(FatalError);
    }

    return autoPtr<dynamicFvMesh>(cstrIter()(io));
}
开发者ID:Haider-BA,项目名称:foam-extend-3.0,代码行数:72,代码来源:newDynamicFvMesh.C

示例15: relativeVelocityModel

Foam::relativeVelocityModels::fromMesoscale::fromMesoscale
(
    const dictionary& dict,
    const incompressibleTwoPhaseInteractingMixture& mixture
)
:
  relativeVelocityModel(dict, mixture),
  Vr_(const_cast< GeometricField < vector, fvPatchField, volMesh > &>(mixture.U().mesh().lookupObject< GeometricField <vector, fvPatchField, volMesh> >(word("Vr"))))
{}
开发者ID:simphony,项目名称:simphony-openfoam,代码行数:9,代码来源:fromMesoscale.C


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