Loading face centered and cell centered variables

Tecplot's Add-on Developer's Kit

Moderators: davetaflin, salter, steve, jprenaud, straton, Chris Idso

Ralph
Newbie
Posts: 6
Joined: Wed May 14, 2008 7:32 am
Location: Germany
Contact:

Loading face centered and cell centered variables

Postby Ralph » Mon May 19, 2008 7:51 am

Hello,

we´re about to write a Tecplot loader which supports our own file format using Tecplot´s ZoneType_FEPolyhedron extension.
So far everything seems to work pretty good. We´re able to load several zones with different nodal variables attached to them.
However we also try to visualize face- and cell centered variables. I tried to find out something in the delivered documents but had no success.

So far the workflow to load node-based data is like:

Code: Select all

TecUtilDataSetCreate("Data Set", CoordList.getRef(), true);
TecUtilDataSetAddVar("nodal based variable", NULL);

//for each var perform calls like:
FieldData_pa fdXVar = TecUtilDataValueGetRef(n_iZone + 1, 1);

//now "link" own data to tecplot, like
TecUtilDataValueArraySetByRef(fdXVar, 1, Debug_CurrentGrid->size_n, &Debug_CurrentGrid->n_x[0]);


This works fine for nodal based values.

How can it be achieved to load face and cell based data into Tecplot?
e.g. A cell having a cell centered value of 1.0 should have a different color than a cell with 2.0. The same for the faces.

I hope I was able to make my problem clear.

Thanks in advance,

Ralph

User avatar
aritzmann
Jedi Master
Posts: 127
Joined: Mon Nov 20, 2006 2:26 pm
Location: Princeton, NJ
Contact:

Re: Loading face centered and cell centered variables

Postby aritzmann » Mon May 19, 2008 3:41 pm

Hi Ralph,

First of all, I am glad to hear that you are working on a data loader for Tecplot. Secondly, I hope that my reply will be of some help to you.

Tecplot supports cell-centered data in a fairly similar manner to that which you have described. The key is that the cell centered values must be provided in an array that is as long as the number of elements in the zone.

Your Code:

Code: Select all

TecUtilDataValueArraySetByRef(fdXVar, 1, Debug_CurrentGrid->size_n, &Debug_CurrentGrid->n_x[0]);


Altered Code:

Code: Select all

TecUtilDataValueArraySetByRef(fdCCVar, 1, Debug_CurrentGrid->size_e, &Debug_CurrentGrid->n_CC[0]);

where: fdCCVar is a handle to a cell-centered field variable's data
           1            is the offset into the data (meaning you start with element 1)
           Debug_CurrentGrid->size_e  (this needs to be changed to reflect the number of elements in your grid)
           &Debug_CurrentGrid->n_CC[0]  ( this is the pointer to the first element of your data array).


I hope that this clarifies how you would go about setting data for a cell-centered variable. When you create a zone in Tecplot, you must go through calling TecUtilDataSetAddZoneX and specify the variable location array. This array allows you to tell Tecplot which variables are cell-centered for the zone being created.

Please let me know if I can be of further assistance.

Best Regards,

Andrew
Andrew Ritzmann

Ralph
Newbie
Posts: 6
Joined: Wed May 14, 2008 7:32 am
Location: Germany
Contact:

Re: Loading face centered and cell centered variables

Postby Ralph » Tue May 20, 2008 4:02 am

Hi Andrew,

Thank you for your fast answer. Seems to be a great support here.

The explanation you gave is clear to me. Passing array sizes to Tecplot via TecUtilDataValueArraySetByRef() actually wasn´t the problem. The mistake was setting up the zone in a correct way. I didn´t specify parameter SV_ZONETYPE further so it looks like Tecplot took "nodal-types" as default ones.
Now the "Data Set Information" dialog box in Tecplot is filled correctly and everything works fine except for one thing: When viewing the zone all values are interpolated over the cells. Is it possible to avoid this while loading? If not how can it be changed withing Tecplot?

Secondly, is it possible to load data into Tecplot that is face-centered only?
I couldn´t find anything in the documentation.

Thank you for your patience.

Regards,

Ralph

User avatar
aritzmann
Jedi Master
Posts: 127
Joined: Mon Nov 20, 2006 2:26 pm
Location: Princeton, NJ
Contact:

Re: Loading face centered and cell centered variables

Postby aritzmann » Tue May 20, 2008 8:17 am

Hi Ralph,

First of all, I am glad to hear that you have set up your zones correctly.

I am not sure that I understand your comment about the values being interpolated over the cells. Tecplot uses interpolation to derive values for contour flooding, streamtraces and isosurfaces. I will take a guess that you are looking for each cell to have a single color based on the cell-centered value. If so, then you can use primary value flooding (see the zone style dialog, contour tab).

Unfortunately, Tecplot does not support data that is face centered for polyhedral data. It is possible to have cell-centered data in a polygonal zone, but there is no direct way to create face-centered data.

Best Regards,

Andrew
Andrew Ritzmann

Ralph
Newbie
Posts: 6
Joined: Wed May 14, 2008 7:32 am
Location: Germany
Contact:

Re: Loading face centered and cell centered variables

Postby Ralph » Tue May 20, 2008 11:15 pm

Hi Andrew,

that´s exactly what I was looking for. In order to identify certain cells it´s better for our purpose to see each cell colored with its primary value.

Again, thank you very much for your help.

Regards,

Ralph

Ralph
Newbie
Posts: 6
Joined: Wed May 14, 2008 7:32 am
Location: Germany
Contact:

Re: Loading face centered and cell centered variables

Postby Ralph » Wed May 21, 2008 4:39 am

Hi again,

unfortunately I have another problem right now.
The "data-loader" I´m currently working on is actually not a data-loader because it´s not build like one. It´s an adaption of your sample "SimpWin" AddOn. The program is located in "Tools" and it´s beeing executed when clicking on its menu entry.
I simply adapted the code one of your tutorials provides.
That was for testing purposes only.
Now I want to port that loading-code into a Data-Loader application which means the loader should be called when importing our own file format.
I´m using VS2005 and tried to adapt the "DataLoader" example which is located in C:\Tecplot\Tec360 2008\adk\vs2005samples\c\DataLoader.
It compiles just fine but when adding certain include files a huge bunch of compiler errors occur which I don´t understand.
Since I have to use your "toolbox\" headers I include for example:

Code: Select all

#include "toolbox/StringList.h"

Recompiling now results in compiler errors like the following ones:

Code: Select all

1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(25) : error C2143: Syntaxfehler: Es fehlt '{' vor ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(25) : error C2059: Syntaxfehler: ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(25) : error C2143: Syntaxfehler: Es fehlt '{' vor ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(25) : error C2059: Syntaxfehler: ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(25) : error C2143: Syntaxfehler: Es fehlt '{' vor ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(25) : error C2059: Syntaxfehler: ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(26) : error C2143: Syntaxfehler: Es fehlt '{' vor ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(26) : error C2059: Syntaxfehler: ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(26) : error C2143: Syntaxfehler: Es fehlt '{' vor ':'
1>C:\Programme\Microsoft Visual Studio 8\VC\include\cstdio(26) : error C2059: Syntaxfehler: ':'

and so on.

Unfortunately it´s German but it just says: Syntax error: Missing '{' before ':'

Compiler settings are the same provided by your sample:

Code: Select all

/Od /I "..\..\..\..\include" /I "..\..\..\..\Build\Win32\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_VC80_UPGRADE=0x0600" /D "_WINDLL" /D "_MBCS" /Gm /EHsc /MTd /Fp".\Debug/DataLoader.pch" /Fo".\Debug/" /Fd".\Debug/" /W3 /nologo /c /Zi /TP /errorReport:prompt


I really have no clue why this error occurs since the other project worked just fine with all "toolbox"-headers.

Thanks in advance.

Best Regards,

Ralph

User avatar
aritzmann
Jedi Master
Posts: 127
Joined: Mon Nov 20, 2006 2:26 pm
Location: Princeton, NJ
Contact:

Re: Loading face centered and cell centered variables

Postby aritzmann » Wed May 21, 2008 8:06 am

Hi Ralph,

I am glad to hear that you are moving to making your add-on into a data loader. The compiler errors seem to be caused by the fact that the extension on the source files for the DataLoader sample is .c and you are adding in some c++ specific headers. Here are the steps to get everything compiled properly:

1. Change all the source files from .c to .cpp
2. Wherever you use a toolbox header, make sure to include toolbox/tptoolbox.h before any toolbox headers in that source file. This avoids some compiler errors.
3. Change the last line of guicb.cpp from #include "guibld.c" to #include "guibld.cpp"
4. Add tptoolbox.lib to your list of libraries in your project settings (linker/input)

This should get you going on everything.

Andrew
Andrew Ritzmann

Ralph
Newbie
Posts: 6
Joined: Wed May 14, 2008 7:32 am
Location: Germany
Contact:

Re: Loading face centered and cell centered variables

Postby Ralph » Wed May 21, 2008 12:56 pm

Hi Andrew,

that´s exactly what I already tried, renaming *.c to *.cpp a few days ago without success.
However now I followed your "guide" and unfortunately other compiler errors show up:

Code: Select all

1>.\guibld.cpp(10) : error C2065: 'LgIndex_t': undeclared identifier
1>.\guibld.cpp(10) : error C2146: syntax error: missing ')' before identifier 'ParentDialog'
1>.\guibld.cpp(10) : error C2182: 'BuildDialog1': illegal use of type 'void'
1>.\guibld.cpp(10) : error C2059: syntax error: ')'
1>.\guibld.cpp(11) : error C2143: syntax error: missing ';' before '{'
1>.\guibld.cpp(11) : error C2447: '{': missing function header (old-style formal list?)
1>.\guibld.cpp(31) : error C2065: 'Dialog1Manager': undeclared identifier
1>.\guibld.cpp(31) : error C2065: 'BADDIALOGID': undeclared identifier


Though the comment in guibld.cpp says not to change that file, I added "#include global.h" for LgIndex_t and "#include tecgui.h" for BADDIALOGID but then either a lot of other compiler errors occur or the following one:

Code: Select all

1>c:\Programme\Tecplot\Tec360 2008\include\tecgui.h(24) : fatal error C1189: #error :  "Include TECGLBL.h before TECGUI.h"

Therefore I definitely think that´s not the right way to include further more or less randomly chosen headers :-)

Incidentially I came across "tgb.cfg" where the second line says "Language=C". Do I have to change something in that file? I tried the obvious thing to alter "Language=C" to "Language=C++" but it didn´t improve anything...

Do you have any clue, what it might be?

Thank you very much for your efforts.

Regards

Ralph

User avatar
aritzmann
Jedi Master
Posts: 127
Joined: Mon Nov 20, 2006 2:26 pm
Location: Princeton, NJ
Contact:

Re: Loading face centered and cell centered variables

Postby aritzmann » Wed May 21, 2008 1:12 pm

Hi Ralph,

guibld.cpp is an automatically generated file that provides the code that is used for the Tecplot GUI builder to generate the dialog. This file is #included into guicb.cpp. Therefore, it needs to be excluded from the build (it is build as part of a different object). Please make sure that it is excluded from the build by right clicking on the file and checking the properties dialog. The file should show up with an icon showing a red - sign.

tgb.cfg is a config file for the tecplot gui builder and is required as part of that project. I believe that Language must equal either c or f (for fortran). Please let me know if this fixes your problem.

Best Regards,

Andrew
Andrew Ritzmann

Ralph
Newbie
Posts: 6
Joined: Wed May 14, 2008 7:32 am
Location: Germany
Contact:

Re: Loading face centered and cell centered variables

Postby Ralph » Thu May 22, 2008 7:34 am

Hi Andrew,

excluding guicb.cpp from building process solved it.
Now everything compiles just fine.
Thank you very much for your patience and the professional advice. I´ve hardly found a forum so far that offers such a high quality support like yours.

Best Regards,

Ralph

Ben

Re: Loading face centered and cell centered variables

Postby Ben » Thu May 22, 2008 2:15 pm

Hi Ralph,

If/when you run into similar issues (e.g. 'LgIndex_t': undeclared identifier), you'll need to #include "TECADDON.h", rather than trying to individually include other Tecplot-supplied headers. The headers we provide are, unfortunately, not self-sufficient individually. Including TECADDON.h will include everything in the correct order.


Return to “Add-on Developer's Kit (ADK)”

Who is online

Users browsing this forum: No registered users and 0 guests