float & TecplotMacros::nd (const unsigned int i,
const unsigned int j)
{
- return nodalData[(i)*(n_nodes) + (j)];
+ return nodalData[i*n_nodes+j];
}
int & TecplotMacros::cd (const unsigned int i,
const unsigned int j)
{
- return connData[(i) + (j)*(n_vert)];
+ return connData[i+j*n_vert];
}
}
int is_double = 0,
tec_debug = 0,
cell_type;
-
-
- unsigned int string_size = 0;
-
- if (spacedim==2)
- string_size = 3;
- else if (spacedim==3)
- string_size = 5;
-
-
- for (unsigned int data_set=0; data_set<n_data_sets; ++data_set)
- {
- string_size += 1;
- string_size += data_names[data_set].size();
- }
-
-
- char *tecVarNames = new char[string_size];
- *tecVarNames = 0;
-
- switch (spacedim)
+ switch (dim)
{
case 2:
- tecVarNames = strncat(tecVarNames, "x y", 3);
+ cell_type = 1;
break;
case 3:
- tecVarNames = strncat(tecVarNames, "x y z", 5);
+ cell_type = 3;
break;
default:
- Assert(false, ExcNotImplemented());
+ Assert(false, ExcNotImplemented());
}
-
- switch (dim)
+
+ std::string tec_var_names;
+ switch (spacedim)
{
case 2:
- cell_type = 1;
+ tec_var_names = "x y";
break;
case 3:
- cell_type = 3;
+ tec_var_names = "x y z";
break;
default:
- Assert(false, ExcNotImplemented());
+ Assert(false, ExcNotImplemented());
}
for (unsigned int data_set=0; data_set<n_data_sets; ++data_set)
{
- tecVarNames = strncat(tecVarNames, " ", 1);
- tecVarNames = strncat(tecVarNames, data_names[data_set].c_str(), data_names[data_set].size());
+ tec_var_names += " ";
+ tec_var_names += data_names[data_set];
}
-
// in Tecplot FEBLOCK format the vertex
// coordinates and the data have an
// order that is a bit unpleasant
num_cells = static_cast<int>(n_cells);
char dot[2] = {'.', 0};
+ // Unfortunately, TECINI takes a
+ // char *, but c_str() gives a
+ // const char *. As we don't do
+ // anything else with
+ // tec_var_names following
+ // const_cast is ok
+ char *var_names=const_cast<char *> (tec_var_names.c_str());
ierr = TECINI (NULL,
- tecVarNames,
+ var_names,
file_name,
dot,
&tec_debug,
Assert (ierr == 0, ExcTecplotAPIError());
}
-
-
- delete [] tecVarNames;
-
#endif
}