7 QString& soluID, QString& cvbar20, QString& density, QString& viscosity,
8 QString& compress, QString& manual, QString& errmsg )
16 QObject::tr(
" Solution/Buffer value determination for data set\n " )
22 got_ok =
solinfo_db( dbP, edata, cvbar20, soluID, bufID, bguid, bdesc,
24 got_ok = got_ok ? got_ok :
25 solinfo_disk( edata, cvbar20, soluID, bufID, bguid, bdesc,
27 got_ok =
bufvals_db( dbP, bufID, bguid, bdesc, density, viscosity,
28 compress, manual, errmsg );
29 got_ok = got_ok ? got_ok :
31 compress, manual, errmsg );
36 got_ok =
solinfo_disk( edata, cvbar20, soluID, bufID, bguid, bdesc,
38 got_ok =
bufvals_disk( bufID, bguid, bdesc, density, viscosity,
39 compress, manual, errmsg );
47 QString& cvbar20, QString& soluID, QString& bufId, QString& bufGuid,
48 QString& bufDesc, QString& errmsg )
55 query <<
"get_rawDataID_from_GUID" << rawGUID;
60 errmsg += QObject::tr(
" Unable to get raw data ID from GUID " )
61 + rawGUID +
"\n" + dbP->
lastError() +
"\n";
67 QString rawID = dbP->
value( 0 ).toString();
68 QString expID = dbP->
value( 1 ).toString();
69 soluID = dbP->
value( 2 ).toString();
72 query <<
"get_solutionBuffer" << soluID;
78 query <<
"get_solutionIDs" << expID;
81 soluID = dbP->
value( 0 ).toString();
84 query <<
"get_solutionBuffer" << soluID;
90 QObject::tr(
"Unable to get solutionBuffer from solution ID" )
91 + soluID +
"\n" + dbP->
lastError() +
"\n";
96 QString
id = dbP->
value( 0 ).toString();
97 QString guid = dbP->
value( 1 ).toString();
98 QString desc = dbP->
value( 2 ).toString();
100 if ( !
id.isEmpty() )
103 bufGuid = guid.isEmpty() ? bufGuid : guid;
104 bufDesc = desc.isEmpty() ? bufDesc : desc;
109 query <<
"get_solution" << soluID;
115 QObject::tr(
"Unable to get solution vbar from solution ID" )
116 + soluID +
"\n" + dbP->
lastError() +
"\n";
121 cvbar20 = dbP->
value( 2 ).toString();
129 QString& cvbar20, QString& soluID, QString& bufId, QString& bufGuid,
130 QString& bufDesc, QString& errmsg )
132 bool bufinfo =
false;
133 QString soluGUID =
"";
138 QFile filei( exppath );
139 if ( !filei.open( QIODevice::ReadOnly | QIODevice::Text ) )
141 errmsg += QObject::tr(
" Unable to open file " ) + exppath +
"\n";
145 QXmlStreamReader xml( &filei );
147 while ( ! xml.atEnd() )
151 if ( xml.isStartElement() )
153 QXmlStreamAttributes ats = xml.attributes();
155 if ( xml.name() ==
"buffer" )
157 QString
id = ats.value(
"id" ).toString();
158 QString guid = ats.value(
"guid" ).toString();
159 QString desc = ats.value(
"desc" ).toString();
161 if ( !
id.isEmpty() || ! guid.isEmpty() )
163 bufId =
id .isEmpty() ? bufId : id;
164 bufGuid = guid.isEmpty() ? bufGuid : guid;
165 bufDesc = desc.isEmpty() ? bufDesc : desc;
167 bufId = bufId.isEmpty() ?
"N/A" : bufId;
172 else if ( xml.name() ==
"solution" )
174 soluGUID = ats.value(
"guid" ).toString();
182 if ( ! bufinfo && ! soluGUID.isEmpty() )
187 QStringList filter(
"S*.xml" );
188 QStringList names = f.entryList( filter, QDir::Files, QDir::Name );
193 for (
int ii = 0; ii < names.size(); ii++ )
195 fname = spath + names[ ii ];
196 QFile filei( fname );
198 if ( ! filei.open( QIODevice::ReadOnly | QIODevice::Text ) )
201 QXmlStreamReader xml( &filei );
203 while ( ! xml.atEnd() )
207 if ( xml.isStartElement() )
209 QXmlStreamAttributes ats = xml.attributes();
211 if ( xml.name() ==
"solution" )
213 QString sguid = ats.value(
"guid" ).toString();
215 if ( sguid != soluGUID )
break;
217 cvbar20 = ats.value(
"commonVbar20" ).toString();
220 else if ( xml.name() ==
"buffer" )
222 QString bid = ats.value(
"id" ).toString();
223 QString bguid = ats.value(
"guid" ).toString();
224 QString bdesc = ats.value(
"desc" ).toString();
226 if ( ! bid.isEmpty() || ! bguid.isEmpty() )
228 bufId = bid .isEmpty() ? bufId : bid;
229 bufId = bufId.isEmpty() ?
"N/A" : bufId;
230 bufGuid = bguid.isEmpty() ? bufGuid : bguid;
231 bufDesc = bdesc.isEmpty() ? bufDesc : bdesc;
250 QString& bufGuid, QString& bufDesc, QString& density, QString& viscosity,
251 QString& compress, QString& manual, QString& errmsg )
253 bool bufvals =
false;
257 if ( bufId.isEmpty() && ! bufGuid.isEmpty() )
260 query <<
"get_bufferID" << bufGuid;
265 errmsg += QObject::tr(
"Unable to get buffer ID from buffer GUID " )
266 + bufGuid +
"\n" + dbP->
lastError() +
"\n";
271 bufId = dbP->
value( 0 ).toString();
272 bufId = bufId.isEmpty() ?
"N/A" : bufId;
276 if ( ! bufId.isEmpty() )
279 query <<
"get_buffer_info" << bufId;
284 QObject::tr(
"Unable to get buffer information from buffer ID " )
285 + bufId +
"\n" + dbP->
lastError() +
"\n";
290 QString ddesc = dbP->
value( 1 ).toString();
291 QString dcomp = dbP->
value( 2 ).toString();
292 QString dvisc = dbP->
value( 4 ).toString();
293 QString ddens = dbP->
value( 5 ).toString();
294 QString dmanu = dbP->
value( 6 ).toString();
295 density = ddens.isEmpty() ? density : ddens;
296 viscosity = dvisc.isEmpty() ? viscosity : dvisc;
297 compress = dcomp.isEmpty() ? compress : dcomp;
298 manual = dmanu.isEmpty() ? manual :
299 ddesc.contains(
" [M]" ) ?
"1" : dmanu;
306 query <<
"get_buffer_desc" << invID;
312 QObject::tr(
"Unable to get buffer description for investigator " )
313 + invID +
"\n" + dbP->
lastError() +
"\n";
317 while ( dbP->
next() )
319 QString desc = dbP->
value( 1 ).toString();
321 if ( desc == bufDesc )
323 bufId = dbP->
value( 0 ).toString();
328 if ( ! bufId.isEmpty() )
331 query <<
"get_buffer_info" << bufId;
337 QObject::tr(
"Unable to get buffer information for buffer ID " )
338 + bufId +
"\n" + dbP->
lastError() +
"\n";
343 QString ddesc = dbP->
value( 1 ).toString();
344 QString dcomp = dbP->
value( 2 ).toString();
345 QString dvisc = dbP->
value( 4 ).toString();
346 QString ddens = dbP->
value( 5 ).toString();
347 QString dmanu = dbP->
value( 6 ).toString();
348 density = ddens.isEmpty() ? density : ddens;
349 viscosity = dvisc.isEmpty() ? viscosity : dvisc;
350 compress = dcomp.isEmpty() ? compress : dcomp;
351 manual = dmanu.isEmpty() ? manual :
352 ddesc.contains(
" [M]" ) ?
"1" : dmanu;
362 QString& bufDesc, QString& density, QString& viscosity,
363 QString& compress, QString& manual, QString& errmsg )
365 bool bufvals =
false;
370 QStringList filter(
"B*.xml" );
371 QStringList names = f.entryList( filter, QDir::Files, QDir::Name );
379 for (
int ii = 0; ii < names.size(); ii++ )
381 fname = bpath + names[ ii ];
382 QFile filei( fname );
384 if ( ! filei.open( QIODevice::ReadOnly | QIODevice::Text ) )
387 QXmlStreamReader xml( &filei );
389 while ( ! xml.atEnd() )
393 if ( xml.isStartElement() && xml.name() ==
"buffer" )
395 QXmlStreamAttributes ats = xml.attributes();
396 QString bid = ats.value(
"id" ).toString();
397 QString bguid = ats.value(
"guid" ).toString();
398 bdesc = ats.value(
"description" ).toString();
399 bid = bid .isEmpty() ?
"EMPTY" : bid;
400 bguid = bguid.isEmpty() ?
"EMPTY" : bguid;
401 bdesc = bdesc.isEmpty() ?
"EMPTY" : bdesc;
403 if ( ( bufGuid !=
"EMPTY" && bguid == bufGuid ) ||
404 ( bufGuid ==
"EMPTY" && bid == bufId ) )
406 bdens = ats.value(
"density" ).toString();
407 bvisc = ats.value(
"viscosity" ).toString();
408 bcomp = ats.value(
"compressibility" ).toString();
409 bmanu = ats.value(
"manual" ).toString();
410 density = bdens.isEmpty() ? density : bdens;
411 viscosity = bvisc.isEmpty() ? viscosity : bvisc;
412 compress = bcomp.isEmpty() ? compress : bcomp;
413 manual = bmanu.isEmpty() ? manual :
414 bdesc.contains(
" [M]" ) ?
"1" : bmanu;
418 else if ( bdesc == bufDesc )
420 bdens = ats.value(
"density" ).toString();
421 bvisc = ats.value(
"viscosity" ).toString();
422 bcomp = ats.value(
"compressibility" ).toString();
423 bmanu = ats.value(
"manual" ).toString();
435 if ( ! bufvals && dfound )
437 density = bdens.isEmpty() ? density : bdens;
438 viscosity = bvisc.isEmpty() ? viscosity : bvisc;
439 compress = bcomp.isEmpty() ? compress : bcomp;
440 manual = bmanu.isEmpty() ? manual :
441 bdesc.contains(
" [M]" ) ?
"1" : bmanu;
448 QObject::tr(
" Unable to find buffer values locally\n"
449 " from buffer ID's (Id,Guid,Desc)\n " )
450 + ( bufId .isEmpty() ? QObject::tr(
"(EMPTY)" ) : bufId ) +
","
451 + ( bufGuid.isEmpty() ? QObject::tr(
"(EMPTY)" ) : bufGuid ) +
","
452 + ( bufDesc.isEmpty() ? QObject::tr(
"(EMPTY)" ) : bufDesc ) +
"\n";