View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000012 | OpenFOAM | Bug | public | 2010-08-27 09:02 | 2010-08-31 10:30 |
Reporter | bgschaid | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Summary | 0000012: sample silently fails to write data if filenames are too long | ||||
Description | When specifying too many fields (or too long field names) the filename (which is constructed from the fields) becomes too long and OFstream does not create a file. sample continues anyway (but no data gets written) | ||||
Steps To Reproduce | Obvious. Sample a lot of fields (all species for a large chemical system for instance) | ||||
Additional Information | I attached a patch that emits a warning if the stream is not valid. Did not let it fail as it might still write the vectors in a separete file (if the file that is too long is the one with the scalars) and as I understand it the code is also used for function objects (and we don't want them to fail, do we) I also included in the patch my personal workaround for the situation: make the sampleDict selectable from the command line with the sample-utility | ||||
Tags | Input/output, Post-processing, Utility | ||||
|
Could not upload the patch. Got this error message: Not Acceptable An appropriate representation of the requested resource /mantisbt/bug_file_add.php could not be found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. I will copy/paste the patch below: # HG changeset patch # Parent 87056e22824fbb36e200f177ae231edcca508a9b diff --git a/applications/utilities/postProcessing/sampling/sample/sample.C b/applications/utilities/postProcessing/sampling/sample/sample.C --- a/applications/utilities/postProcessing/sampling/sample/sample.C +++ b/applications/utilities/postProcessing/sampling/sample/sample.C @@ -95,6 +95,8 @@ int main(int argc, char *argv[]) { + argList::validOptions.insert("sampleDict","sample dictionary"); + timeSelector::addOptions(); # include "addRegionOption.H" # include "setRootCase.H" @@ -102,11 +104,17 @@ instantList timeDirs = timeSelector::select0(runTime, args); # include "createNamedMesh.H" + word sampleDict="sampleDict"; + if(args.options().found("sampleDict")) + { + sampleDict=args.options()["sampleDict"]; + } + IOsampledSets sSets ( sampledSets::typeName, mesh, - "sampleDict", + sampleDict, IOobject::MUST_READ, true ); @@ -115,7 +123,7 @@ ( sampledSurfaces::typeName, mesh, - "sampleDict", + sampleDict, IOobject::MUST_READ, true ); diff --git a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C --- a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C +++ b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C @@ -157,12 +157,21 @@ timeDir/formatter.getFileName(masterSampleSet, valueSetNames) ); + OFstream oFile(fName); + if(!oFile.opened()) + { + WarningIn("Foam::sampledSets::writeSampleFile") + << " File " << oFile.name() << " was not opened. " + << " This means that propably no data will be written" + << endl; + } + formatter.write ( masterSampleSet, valueSetNames, valueSets, - OFstream(fName)() + oFile ); } |
|
Updates pushed under 1.7.x commit reference ccc32ab38001 |
Date Modified | Username | Field | Change |
---|---|---|---|
2010-08-27 09:02 | bgschaid | New Issue | |
2010-08-27 09:04 | bgschaid | Note Added: 0000005 | |
2010-08-27 09:14 | bgschaid | Tag Attached: Input/output | |
2010-08-27 09:26 |
|
Assigned To | => user2 |
2010-08-27 09:26 |
|
Status | new => assigned |
2010-08-27 10:10 |
|
Note Added: 0000007 | |
2010-08-27 10:10 |
|
Status | assigned => resolved |
2010-08-27 10:10 |
|
Fixed in Version | => 1.7.x |
2010-08-27 10:10 |
|
Resolution | open => fixed |
2010-08-31 10:30 |
|
Tag Attached: Post-processing | |
2010-08-31 10:30 |
|
Tag Attached: Utility |