Commit 48a111c5 authored by mark's avatar mark

BUG: parcel encoding information stop on unknown token

- anything that is unknown (encodes with a zero-width) must also
  be a sign to stop, since we can't say anything more.

  Currently these are still trigged by lists (tagged as 'scalars'),
  since we don't yet have a way to get their widths.
parent a6d734f5
......@@ -8,6 +8,7 @@ EXE_INC = -DFOAM_PLATFORM="$(WM_ARCH)$(WM_COMPILER)" \
$(PFLAGS) $(PINC) \
$(ADIOS_INC) $(ADIOS_EXTRA_COMP) \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
-I$(LIB_SRC)/lagrangian/spray/lnInclude \
-I$(LIB_SRC)/lagrangian/intermediate/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
......
......@@ -49,12 +49,11 @@ void Foam::ParcelEncoding::setTypes(Istream& is)
while (is.read(tok))
{
word inputType;
bool varargs = false;
bool stop = false;
if (tok.type() == token::WORD)
{
inputType = tok.wordToken();
// Info<< "type " << size() << " = " << inputType << " offset " << length_ << endl;
}
else if (tok.type() == token::PUNCTUATION)
{
......@@ -63,13 +62,14 @@ void Foam::ParcelEncoding::setTypes(Istream& is)
case token::BEGIN_BLOCK:
case token::END_BLOCK:
++length_;
// Info<< "tok " << size() << " = " << tok.pToken() << " offset: " << length_ << endl;
// Info<< "tok " << size() << " = "
// << tok.pToken() << " offset: " << length_ << endl;
break;
case token::MULTIPLY:
// stop after encountering the first dynamic length entry
varargs = true;
inputType = "*";
inputType = "*"; // pass through glob as a word
stop = true;
break;
default:
......@@ -93,10 +93,22 @@ void Foam::ParcelEncoding::setTypes(Istream& is)
if (!inputType.empty())
{
Fragment frag(inputType, length_);
length_ += frag.width();
append(frag);
if (varargs)
if (!frag.width() && !stop)
{
// Unknown type: replace with '?' and stop now
// In most cases, this is from things like "scalars" lists
Fragment unknown("?", length_);
append(unknown);
stop = true; // and stop now
}
else
{
length_ += frag.width();
append(frag);
}
if (stop)
{
break;
}
......@@ -309,7 +321,7 @@ Foam::ParcelEncoding::ParcelEncoding
names_(),
length_(0)
{
// Info << "inputTypes: " << inputTypes << endl;
// Info<< "inputTypes: " << inputTypes << endl;
setTypes(IStringStream(inputTypes)());
setNames(IStringStream(inputNames)());
......
......@@ -80,7 +80,7 @@ class ParcelEncodingFragment
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const ParcelEncodingFragment&);
void operator=(const ParcelEncodingFragment&) = delete;
//- Width and nComponents for supported primitives
......
......@@ -36,7 +36,9 @@ Foam::ParcelEncoding::ParcelEncoding
names_(),
length_(0)
{
// Info << "inputTypes: " << CloudType::particleType::propertyTypes() << endl;
Info<< "inputTypes: " << CloudType::particleType::propertyTypes() << endl;
Info<< "inputNames: " << CloudType::particleType::propertyList() << endl;
setTypes(IStringStream(CloudType::particleType::propertyTypes())());
setNames(IStringStream(CloudType::particleType::propertyList())());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment