Run-time error : "Invalid parameter"

[size=large]Version “olb-0.5r0”[/size]

Run-time error of type-conflict : “Invalid parameter”.

Error occuring in each example when calling the function “produceGif”.
Constant “imSize” declared “int”.
When calling the member functions “writeGif/writeScaledGif” of the class “ImageWriter”
with effective parameter “imSize” declared “int”.
Formal parameters “sizeX, sizeY” declared “double” (“typedef double T”).

The error persists even if the effective constant is forced from “int” to “T” !!

Surely anybody holds the solution for this trivial question, still unsolved for me !

Dominique.Deserable@insa-rennes.fr

We need to know your compiler, the compiler version, and the exact error message in order to give you a useful answer.

Hi, jlatt!

I got the same kind of question when execute the Lesson one program as in the User Guide.

While the compilation process seems OK, Error of “Invalid parameter - lesson1.gif” occuring.

I use gcc Version 3.4.4 with cygwin.

Other example programs also don’t yield any .gif files.

Could you tell me where the sources of problem are ? I will greatly appreciate it.

Alex Lee

Hi, Alex!

I had the same problem, because files are written in “\tmp” folder. So you need to create it, and then the program can access it and write gif files.

Hi Jlatt,

My compiler version, as for Alexlee, is the cygwin gcc 3.4.4. version.

It is displayed as “/usr/lib/gcc/i686-pc-cygwin/3.4.4” in the “poiseuille.d” file.

Anyway, there is a conflict in “olb-0.5r0” between:
- the (int) imSize in “produceGif”, declared in “poiseuille.cpp” and other examples.
- the (T) sizeX (resp. sizeY) in member “writeScaledGif” of ImageWriter.
See below:


[size=small]void produceGif(int iT, BlockStructure2D<T, DESCRIPTOR>& lattice) {
const int imSize = 400;

imageWriter.writeScaledGif(createFileName(“p”, iT, 6),
analysis.getPressure(), imSize, imSize);
imageWriter.writeScaledGif(createFileName(“u”, iT, 6),
analysis.getVelocityNorm(), imSize, imSize);
}[/size]

[size=small]class ImageWriter {
public:

void writeScaledGif(std::string const& fName,
ScalarFieldBase2D const& field,
T sizeX, T sizeY) const;

};[/size]

Whence the periodic runtime-error in the main loop of “poiseuille”
with saveIter=2000:


[size=small]for (int iT=0; iT<maxIter; ++iT) {

if (iT%saveIter==0) {
produceGif(iT, lattice);
… }

}[/size]

[size=small]…
Iteration 6000; t= … E=… rho= … uMax= …
Paramètre non valide - 400x400
Paramètre non valide - 400x400
Iteration 6100; t= … E=… rho= … uMax= …

Iteration 7900; t= … E=… rho= … uMax= …
Iteration 8000; t= … E=… rho= … uMax= …
Paramètre non valide - 400x400
Paramètre non valide - 400x400
…[/size]

I had the same problem, because files are written in “\tmp” folder.
So you need to create it, and then the program can access it and write gif files.

Hi Alex,
I think no!
Result files are correctly created in \tmp folder, NOT gif files.

Hi,

Anyway, there is a conflict in “olb-0.5r0” between:

  • the (int) imSize in “produceGif”, declared in “poiseuille.cpp” and other examples.
  • the (T) sizeX (resp. sizeY) in member “writeScaledGif” of ImageWriter.

You’ve got a point here. I’ll check out if the parameters of writeScaledGif should be int instead of T.

But this is unrelated to your problem. The error message

Paramètre non valide - 400x400

is produced by the package ImageMagick. This seems to imply that your version of ImageMagick does not have the same syntax as all versions I’ve previously encountered in my life. It may be an older version, or a newer one, or - that’s a wild guess - a French version which takes French keywords instead of English ones.

Here’s how to check. Start up your Cygwin shell, and change into a directory with a .ppm file, say, pic.ppm. Enter the command

convert -resize 400x400 pic.ppm pic.gif

I expect that you get the same error message as above. Your job now is to find the proper syntax for your version of ImageMagick (“man convert”), and change this correspondingly in the OpenLB source code for ImageWriter. Please tell us what you found, we’re definitely interested!

Good luck.

Thanks you all!

Everything is OK! I reloaded the ImageMagick Package.

Hi all!
Just a hint:
The true truth is that Poiseuille worked well the first time! (i.e. it produced the gif images in the .\tmp folder),
but not the second, neither the third, nor the fourth, nor Cylinder2d, nor Bstep2D, and so forth…

[size=small]Hi jlatt n’ all,

But this is unrelated to your problem. The error message “Paramètre non valide - 400x400”
is produced by the package ImageMagick. (…)
Here’s how to check. Start up your Cygwin shell, and change into a directory with a .ppm file, say, pic.ppm.
Enter the command

convert -resize 400x400 pic.ppm pic.gif

So, trying the command:

convert -resize 400x400 teapot.ppm teapot.gif

I got, unfortunately, a wonderful ray-traced teapot setup on a chessboard within a sweet blue background.

Well…, there’s the rub!
Why “Poiseuille” was working well the first time, but not the second neither the third nor the fourth one…?
Type “int” vs “T” was indeed the wrong question.
Sorry! Because I was so glad of the successful issue of “Poiseuille” the first time that I forgot the fact, running it again on the spur of the moment, by double-clicking “poiseuille.exe” in the Windows’ window directory: the fault!!

Advice: remain in the Cygwin environnement when running OpenLB, and keep Windows only for related actions!

Dominique

[/size]

Hi all:

I have the same problem with cygwin, I have “solved” writing ppm files instead of gif files, using

        imageWriter.writeScaledPpm(createFileName("p", iT, 6), analysis.getPressure());
        imageWriter.writeScaledPpm(createFileName("u", iT, 6), analysis.getVelocityNorm());

instead of:

        imageWriter.writeScaledGif(createFileName("p", iT, 6), analysis.getPressure());
        imageWriter.writeScaledGif(createFileName("u", iT, 6), analysis.getVelocityNorm());

this don’t solve the problem but the simulation runs, and I can see the ppm using IrfanView.

Regards.