mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-12 22:20:35 +05:00
replace char* by string
This commit is contained in:
parent
5d62946130
commit
4cb120047c
@ -308,7 +308,7 @@ extern "C" {
|
||||
|
||||
struct Ng_SolutionData
|
||||
{
|
||||
const char * name; // name of gridfunction
|
||||
string name; // name of gridfunction
|
||||
double * data; // solution values
|
||||
int components; // relevant (double) components in solution vector
|
||||
int dist; // # doubles per entry alignment!
|
||||
|
@ -79,8 +79,8 @@ namespace netgen
|
||||
|
||||
for (int i = 0; i < vssolution.soldata.Size(); i++)
|
||||
{
|
||||
if ( (strlen (vssolution.soldata[i]->name) == size_t(pointpos-1)) &&
|
||||
(strncmp (vssolution.soldata[i]->name, scalname, pointpos-1) == 0) )
|
||||
if ( (strlen (vssolution.soldata[i]->name.c_str()) == size_t(pointpos-1)) &&
|
||||
(strncmp (vssolution.soldata[i]->name.c_str(), scalname, pointpos-1) == 0) )
|
||||
{
|
||||
vssolution.scalfunction = i;
|
||||
vssolution.scalcomp = atoi (scalname + pointpos);
|
||||
@ -96,10 +96,10 @@ namespace netgen
|
||||
Tcl_SetVar ( interp, "::visoptions.scalfunction", newscalname, TCL_GLOBAL_ONLY );
|
||||
scalname = Tcl_GetVar (interp, "::visoptions.scalfunction", TCL_GLOBAL_ONLY);
|
||||
}
|
||||
if (strcmp (vssolution.soldata[i]->name, vecname) == 0)
|
||||
if (strcmp (vssolution.soldata[i]->name.c_str(), vecname) == 0)
|
||||
vssolution.vecfunction = i;
|
||||
|
||||
if (strcmp (vssolution.soldata[i]->name, fieldlines_vecname) == 0)
|
||||
if (strcmp (vssolution.soldata[i]->name.c_str(), fieldlines_vecname) == 0)
|
||||
vssolution.fieldlines_vecfunction = i;
|
||||
}
|
||||
|
||||
@ -315,7 +315,7 @@ namespace netgen
|
||||
return TCL_ERROR;
|
||||
|
||||
for (i = 0; i < vssolution.GetNSolData(); i++)
|
||||
if (strcmp (vssolution.GetSolData(i)->name, argv[2]) == 0)
|
||||
if (strcmp (vssolution.GetSolData(i)->name.c_str(), argv[2]) == 0)
|
||||
{
|
||||
cout << "found soldata " << i << endl;
|
||||
}
|
||||
@ -328,7 +328,7 @@ namespace netgen
|
||||
|
||||
if (strcmp (argv[1], "getfieldname") == 0)
|
||||
{
|
||||
sprintf (buf, "%s", vssolution.GetSolData(atoi(argv[2])-1)->name);
|
||||
sprintf (buf, "%s", vssolution.GetSolData(atoi(argv[2])-1)->name.c_str());
|
||||
}
|
||||
|
||||
if (strcmp (argv[1], "iscomplex") == 0)
|
||||
@ -346,7 +346,7 @@ namespace netgen
|
||||
{
|
||||
for (i = 0; i < vssolution.GetNSolData(); i++)
|
||||
{
|
||||
strcat (buf, vssolution.GetSolData(i)->name);
|
||||
strcat (buf, vssolution.GetSolData(i)->name.c_str());
|
||||
strcat (buf, " ");
|
||||
}
|
||||
strcat (buf, "var1 var2 var3");
|
||||
|
@ -24,12 +24,12 @@ namespace netgen
|
||||
|
||||
|
||||
VisualSceneSolution :: SolData :: SolData ()
|
||||
: name (0), data (0), solclass(0)
|
||||
: data (0), solclass(0)
|
||||
{ ; }
|
||||
|
||||
VisualSceneSolution :: SolData :: ~SolData ()
|
||||
{
|
||||
delete [] name;
|
||||
// delete [] name;
|
||||
delete data;
|
||||
delete solclass;
|
||||
}
|
||||
@ -86,7 +86,8 @@ namespace netgen
|
||||
int funcnr = -1;
|
||||
for (int i = 0; i < soldata.Size(); i++)
|
||||
{
|
||||
if (strcmp (soldata[i]->name, sd->name) == 0)
|
||||
// if (strcmp (soldata[i]->name, sd->name) == 0)
|
||||
if (soldata[i]->name == sd->name)
|
||||
{
|
||||
delete soldata[i];
|
||||
soldata[i] = sd;
|
||||
@ -4778,7 +4779,7 @@ void Ng_ClearSolutionData ()
|
||||
|
||||
void Ng_InitSolutionData (Ng_SolutionData * soldata)
|
||||
{
|
||||
soldata -> name = NULL;
|
||||
// soldata -> name = NULL;
|
||||
soldata -> data = NULL;
|
||||
soldata -> components = 1;
|
||||
soldata -> dist = 1;
|
||||
@ -4797,9 +4798,9 @@ void Ng_SetSolutionData (Ng_SolutionData * soldata)
|
||||
// vssolution.ClearSolutionData ();
|
||||
netgen::VisualSceneSolution::SolData * vss = new netgen::VisualSceneSolution::SolData;
|
||||
|
||||
vss->name = new char[strlen (soldata->name)+1];
|
||||
strcpy (vss->name, soldata->name);
|
||||
|
||||
// vss->name = new char[strlen (soldata->name)+1];
|
||||
// strcpy (vss->name, soldata->name);
|
||||
vss->name = soldata->name;
|
||||
vss->data = soldata->data;
|
||||
vss->components = soldata->components;
|
||||
vss->dist = soldata->dist;
|
||||
|
@ -136,7 +136,7 @@ public:
|
||||
SolData ();
|
||||
~SolData ();
|
||||
|
||||
char * name;
|
||||
string name;
|
||||
double * data;
|
||||
int components;
|
||||
int dist;
|
||||
|
Loading…
Reference in New Issue
Block a user