File: tMemoryTable.cc

package info (click to toggle)
casacore 3.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 51,680 kB
  • sloc: cpp: 462,815; fortran: 16,372; ansic: 7,403; yacc: 4,626; lex: 2,340; sh: 1,786; python: 629; perl: 531; sed: 499; csh: 34; makefile: 31
file content (676 lines) | stat: -rw-r--r-- 17,723 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
//# tMemoryTable.cc: Test program for the MemoryTable class
//# Copyright (C) 2003,2004
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This program is free software; you can redistribute it and/or modify it
//# under the terms of the GNU General Public License as published by the Free
//# Software Foundation; either version 2 of the License, or (at your option)
//# any later version.
//#
//# This program is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
//# more details.
//#
//# You should have received a copy of the GNU General Public License along
//# with this program; if not, write to the Free Software Foundation, Inc.,
//# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//#        Internet email: aips2-request@nrao.edu.
//#        Postal address: AIPS++ Project Office
//#                        National Radio Astronomy Observatory
//#                        520 Edgemont Road
//#                        Charlottesville, VA 22903-2475 USA
//#
//# $Id$

#include <casacore/tables/Tables/TableDesc.h>
#include <casacore/tables/Tables/SetupNewTab.h>
#include <casacore/tables/Tables/Table.h>
#include <casacore/tables/Tables/TableRecord.h>
#include <casacore/tables/Tables/ScaColDesc.h>
#include <casacore/tables/Tables/ArrColDesc.h>
#include <casacore/tables/Tables/ScalarColumn.h>
#include <casacore/tables/Tables/ArrayColumn.h>
#include <casacore/tables/TaQL/ExprNode.h>
#include <casacore/tables/DataMan/VirtualTaQLColumn.h>
#include <casacore/casa/BasicSL/Complex.h>
#include <casacore/casa/Arrays/Vector.h>
#include <casacore/casa/IO/ArrayIO.h>
#include <casacore/casa/Arrays/Cube.h>
#include <casacore/casa/Arrays/ArrayMath.h>
#include <casacore/casa/Arrays/ArrayLogical.h>
#include <casacore/casa/IO/ArrayIO.h>
#include <casacore/casa/Containers/Record.h>
#include <casacore/casa/OS/Path.h>
#include <casacore/casa/Utilities/Assert.h>
#include <casacore/casa/Exceptions/Error.h>
#include <casacore/casa/iostream.h>

#include <casacore/casa/namespace.h>
// <summary>
// Test program for the MemoryTable class.
// </summary>


// (re) open and write a few rows
// aMode == 0  open new
// aMode == 1  use existing
void init (uInt aMode, Table&);

// reopen table, and throw away a row
void deleteRow(const uInt aRow, Table&);

// reopen table, and throw away a few rows
void deleteRows(const Vector<rownr_t>& aNrRows, Table&);

// delete a Column
void deleteColumn(const String aColumn, Table&);

// delete a column && put it back again
void deleteAndRestore(Table&);

// add a Column
void addColumn(DataType aDataType, Table&);

// add a few direct arrays
void addDirectArrays(Table&);

// add an indirect string array
void addIndStringArray(Table&);

// add an indirect array
void addIndArray(Table&);

// add a keyword and subtable
void addKeys(Table&);

// show table info
void info(const Table& aTable);

// put/putColumn cache test
void putColumnTest(Table&);

// Copy the table to a plain table
void copyTable(const Table&);

// Copy a reftable to the memory table to a plain table
void copyRefTable(const Table&);

// Copy the table to a memory table
void copyMemoryTable(const Table&);

// Copy a subset of a table to a memory table
void copyMemoryTableSubSet(const Table&);


int main ()
{
    try {
	Table tab;
	init            (0, tab);
        init            (1, tab);
	deleteRow       (0, tab);
	deleteRow       (17, tab);
	// delete and restore Column 1 (should use perfect fit)
	deleteAndRestore(tab);
	// 
	putColumnTest(tab);
	// delete middle Column
       	deleteColumn    ("Col-2", tab);
	// add a Bool Column Should fit in freed space
	addColumn       (TpBool, tab);
	// add a DComplex Column Should use new index && space
	addColumn       (TpDComplex, tab);
	// Test the copy table stuff.
	{
	  cout << endl << "Test copying ..." << endl;
	  Table tabc = tab.copyToMemoryTable ("tmtestc");
	  // Add a keyword and a subtable.
	  addKeys (tabc);
	  // copy to a plain table
	  copyTable(tabc);
	  // copy a reference to a plain table
          ///	  copyRefTable(tabc);
	  // copy to a memory table
	  copyMemoryTable(tabc);
	  // copy a subset to a memory table
	  copyMemoryTableSubSet(tabc);
	  // copy from a plain table
	  {
	    Table tab2("tMemoryTable_tmp.tabcp");
	    copyMemoryTable(tab2);
	    copyMemoryTableSubSet(tab2);
	  }
	  cout << endl;
	}
	// delete first Column
	deleteColumn    ("Col-1", tab);
	// delete last Column
	deleteColumn    ("Col-3", tab);
	addDirectArrays (tab);
	addIndStringArray(tab);
	addIndArray     (tab);
        Vector<rownr_t> aNrRows(3);
	for (uInt i=0; i< 3; i++) {
	  aNrRows(i) = i+3;
	}
	deleteRows      (aNrRows, tab);
	deleteColumn    ("Col-7", tab);
       	addColumn       (TpString, tab);
	// remove all remaining rows to check freebucket performance
        Vector<rownr_t> aNewNrRows(15);
	for (uInt i=0; i< 15; i++) {
	  aNewNrRows(i) = i;
	}
	deleteRows      (aNewNrRows, tab);


    } catch (std::exception& x) {
	cout << "Caught an exception: " << x.what() << endl;
	return 1;
    } 
    return 0;                           // exit with success status
}

void initArrays (Cube<Float>& arrf, Vector<DComplex>& arrdc, Cube<Bool>& arrb)
{
      // The static_cast is a workaround for an SGI compiler bug
    indgen (static_cast< Cube<Float> &>(arrf));
    arrdc(0) = DComplex(1.2, 3.4);
    arrdc(1) = DComplex(-2.3, 5.6);
    IPosition shape(arrb.shape());
    uInt n = 0;
    for (Int i=0; i<shape(2); i++) {
	for (Int j=0; j<shape(1); j++) {
	    for (Int k=0; k<shape(0); k++) {
		if (n++%3 == 2) {
		    arrb(k,j,i) = True;
		}else{
		    arrb(k,j,i) = False;
		}
	    }
	}
    }
}

void info (const Table& aTable)
{
  cout << "TableType = " << aTable.tableType() << endl;
  TableDesc tdesc = aTable.tableDesc();
  for (uInt i=0; i<tdesc.ncolumn(); i++) {
    const ColumnDesc& cdesc = tdesc.columnDesc(i);
    cout << cdesc.name() << ": " 
	 << cdesc.dataType() << endl;
    switch (cdesc.dataType()) {
    case TpInt:
      if (cdesc.isArray()) {
	ArrayColumn<Int> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      } else {
	ScalarColumn<Int> aa(aTable,cdesc.name());
	cout << aa.getColumn() << endl;
      }
      break;
    case TpBool:
      if (cdesc.isArray()) {
	ArrayColumn<Bool> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      } else {
	ScalarColumn<Bool> ab(aTable,cdesc.name());
	cout << ab.getColumn() << endl;
      }
      break;
    case TpDComplex:
      if (cdesc.isArray()) {
	ArrayColumn<DComplex> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      } else {
	ScalarColumn<DComplex> ac(aTable,cdesc.name());
	cout << ac.getColumn() << endl;
      }
      break;
    case TpFloat:
      if (cdesc.isArray()) {
	ArrayColumn<float> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      } else {
	ScalarColumn<float> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      }
      break;
    case TpDouble:
      if (cdesc.isArray()) {
	ArrayColumn<double> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      } else {
	ScalarColumn<double> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      }
      break;
    case TpString:
      if (cdesc.isArray()) {
	ArrayColumn<String> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      } else {
	ScalarColumn<String> ad(aTable,cdesc.name());
	cout << ad.getColumn() << endl;
      }
      break;
    default:
      cout << "Sorry, datatype not implemented yet." << endl;
    }
  }
  const TableRecord& rec = aTable.keywordSet();
  for (uInt i=0; i<rec.nfields(); i++) {
    cout << rec.name(i) << '=';
    switch (rec.type(i)) {
    case TpTable:
      cout << "Record" << endl;
      info (rec.asTable(i));
      break;
    case TpBool:
      cout << rec.asBool(i) << endl;
      break;
    case TpString:
      cout << rec.asString(i) << endl;
      break;
    case TpDComplex:
    case TpComplex:
      {
	DComplex val;
	rec.get (i, val);
	cout << val << endl;
      }
      break;
    default:
      {
	Double val;
	rec.get (i, val);
	cout << val << endl;
      }
    }
  }
}

// First build a description.
void init (uInt aMode, Table& aTable)
{
  if (aMode == 0) {
    // Build the table description.
    TableDesc td("", "1", TableDesc::Scratch);
    td.comment() = "A test of class TableDesc";
    td.addColumn (ScalarColumnDesc<DComplex>("Col-1"));
    td.addColumn (ScalarColumnDesc<Int>("Col-2"));
    td.addColumn (ScalarColumnDesc<Bool>("Col-3"));
    td.addColumn (ScalarColumnDesc<Int>("Colvirt"));
    
    // Now create a new table from the description.
    SetupNewTable aNewTab("tmtest", td, Table::New);
    VirtualTaQLColumn engine("2*rownumber()");
    aNewTab.bindColumn("Colvirt", engine);
    aTable = Table (aNewTab, Table::Memory, 10);
    AlwaysAssertExit (aTable.isColumnStored ("Col-1"));
    AlwaysAssertExit (aTable.isColumnStored ("Col-2"));
    AlwaysAssertExit (aTable.isColumnStored ("Col-3"));
    AlwaysAssertExit (!aTable.isColumnStored ("Colvirt"));
  }
  
  ScalarColumn<DComplex> aa(aTable,"Col-1");
  ScalarColumn<Int>      ab(aTable,"Col-2");
  ScalarColumn<Bool>     ac(aTable,"Col-3");
  
  // fill columns with data
  uInt i;
  uInt j = 0;
  for (i=0; i<10; i++) {
    if (aMode == 1) {
      aTable.addRow();
      j=10;
    }
    DComplex a(i+j,(i+j)*2);
    aa.put(i+j,a);
    ab.put(i+j,i+j);
    Bool b;
    if ((i+j)%2 == 0) {
      b=True;
    } else {
      b=False;
    }
    ac.put(i+j,b);
  }
  
  if (aMode == 0) {
    cout << "after creation" << endl;
  } else {
    cout << "after reopening and adding 10 rows" << endl;
  }
  
  // Print column data
  info(aTable);
}

void deleteRow(const uInt aRow, Table& aTable)
{
  ScalarColumn<DComplex> aa(aTable,"Col-1");

  // Make sure ColumnCache is filled.
  aa(0);

  aTable.removeRow(aRow);
  
  cout << "after removing row: " << aRow << endl;

  // Print column data
  info(aTable);
}

void deleteRows(const Vector<rownr_t>& aNrRows, Table& aTable)
{
  ScalarColumn<DComplex> ae(aTable,"Col-5");

  // Make sure ColumnCache is filled.
  ae(0);

  aTable.removeRow(aNrRows);
  
  cout << "after removing several rows at once: " << endl;

  // Print column data
  info(aTable);
}

void deleteColumn(const String aColumn, Table& aTable)
{
  cout << "Try to remove Column:" << aColumn << endl;
  
  aTable.removeColumn(aColumn);

  cout << "After removing Column: " << aColumn << endl;

  // Print column data
  info(aTable);
}

void deleteAndRestore (Table& aTable)
{
  ScalarColumn<DComplex> ac(aTable,"Col-1");
  cout << "Try to remove Column 1 after saving the contents" << endl;
  Vector<DComplex> save = ac.getColumn();
  aTable.removeColumn("Col-1");
  
  cout << "After removing Column 1" << endl;
  
  // Print column data
  info(aTable);
  
  cout << "Try to restore Column 1" << endl;
  aTable.addColumn(ScalarColumnDesc<DComplex>("Col-1"));
  
  if (aTable.tableDesc().isColumn("Col-1")) {
    ac.attach(aTable,"Col-1");
  }
  
  // refill again
  ac.putColumn(save);

  // Print column data
  cout << "After restoring Column1:" << endl;
  info(aTable);
}


void addColumn(DataType aDataType, Table& aTable)
{
  ScalarColumn<Bool>      ad;
  ScalarColumn<DComplex>  ae;
  ScalarColumn<String>    aj;
  
  switch (aDataType) {
    
  case TpBool:
    cout << "Try to add Column: Col-4 and fill it. "<< endl <<
      "It Should be using space just freed up"  << endl;
    
    aTable.addColumn(ScalarColumnDesc<Bool>("Col-4"));
    
    if (aTable.tableDesc().isColumn("Col-4")) {
      ad.attach(aTable,"Col-4");
    }
    
    // fill new column with data
    uInt i;
    Bool b;
    for (i=0; i<aTable.nrow(); i++) {
      if (i < 10) {
	b=True;
      } else {
	b=False;
      }
      ad.put(i,b);
    }
    break;
  case TpDComplex:
    cout << "Try to add Column: Col-5 and fill it. "<< endl <<
      "It should make a new index because there's not enough free space" << endl;
    
    aTable.addColumn(ScalarColumnDesc<DComplex>("Col-5"));
    
    if (aTable.tableDesc().isColumn("Col-5")) {
      ae.attach(aTable,"Col-5");
    }
    
    // fill new column with data
    for (uInt i=0; i<aTable.nrow(); i++) {
      DComplex a(aTable.nrow()-i,i);
      ae.put(i,a);
    }
    break;
  case TpString:
    {
      cout << "Try to add a string Column: Col-10 and fill it. "<< endl;
      
      aTable.addColumn(ScalarColumnDesc<String>("Col-10"));
      
      if (aTable.tableDesc().isColumn("Col-10")) {
	aj.attach(aTable,"Col-10");
      }
      
      String aString("String-1");
      
      // fill new column with data
      for (uInt i=0; i<aTable.nrow(); i++) {
	aj.put(i,aString);
	aString += " "+String::toString(i);
      }
    }
    break;
  default:
    cout << "Not implemented yet" << endl;
    break;
  }
  
  info(aTable);
}

void addDirectArrays (Table& aTable)
{
  ArrayColumn<float>      af;
  ArrayColumn<DComplex>   ag;
  ArrayColumn<Bool>       ah;
  

  cout << "Trying to add a few  Direct Array Columns." << endl;

  aTable.addColumn(ArrayColumnDesc<float>("Col-6", IPosition(3,2,3,1),
					  ColumnDesc::Direct));
    
  aTable.addColumn(ArrayColumnDesc<DComplex>("Col-7", IPosition(1,2),
					     ColumnDesc::Direct));
    
  aTable.addColumn(ArrayColumnDesc<Bool>("Col-8", IPosition(3,5,7,1),
					 ColumnDesc::Direct));
    

  Cube<float> arrf(IPosition(3,2,3,1));
  Vector<DComplex> arrdc(2);
  Cube<Bool> arrb(IPosition(3,5,7,1));
  initArrays (arrf, arrdc, arrb);

  if (aTable.tableDesc().isColumn("Col-6")) {
    af.attach(aTable,"Col-6");
  }
  if (aTable.tableDesc().isColumn("Col-7")) {
    ag.attach(aTable,"Col-7");
  }
  if (aTable.tableDesc().isColumn("Col-8")) {
    ah.attach(aTable,"Col-8");
  }

  for (uInt i=0; i<aTable.nrow(); i++) {
    af.put(i,arrf);
    ag.put(i,arrdc);
    ah.put(i,arrb);
    arrf += (float)(arrf.nelements());
    arrdc += DComplex(2, 3);
  }

  info(aTable);
}

void addIndStringArray (Table& aTable)
{
  ArrayColumn<String>       ai;

  cout << "Trying to add an  indirect String Array Column." << endl;

  aTable.addColumn(ArrayColumnDesc<String>("Col-9"));
    
  Vector<String> arrs(5);
  arrs(0)="Start-1";
  arrs(1)="Start-2";
  arrs(2)="Start-3";
  arrs(3)="Start-4";
  arrs(4)="Start-5";

  if (aTable.tableDesc().isColumn("Col-9")) {
    ai.attach(aTable,"Col-9");
  }

  for (uInt i=0; i<aTable.nrow(); i++) {
    ai.put(i,arrs);
    for (uInt j=0; j< 5;j++) {
      arrs(j) += " "+String::toString(i);
    }
  }

  info(aTable);
}

void addIndArray (Table& aTable)
{
  ArrayColumn<Int>       ak;

  cout << "Trying to add an  indirect Array Column." << endl;

  aTable.addColumn(ArrayColumnDesc<Int>("Col-11"));
    
  Vector<Int> arrs(5);
  arrs(0)=1;
  arrs(1)=2;
  arrs(2)=3;
  arrs(3)=4;
  arrs(4)=5;

  if (aTable.tableDesc().isColumn("Col-11")) {
    ak.attach(aTable,"Col-11");
  }

  for (uInt i=0; i<aTable.nrow(); i++) {
    ak.put(i,arrs);
    for (uInt j=0; j< 5;j++) {
      arrs(j) += i;
    }
  }

  info(aTable);
}

void addKeys(Table& tab)
{
  tab.rwKeywordSet().define ("Key1", "abc");
  // Create a subtable.
  TableDesc td("", "1", TableDesc::Scratch);
  td.addColumn (ScalarColumnDesc<String> ("str"));
  SetupNewTable aNewTab("tmtest", td, Table::New);
  Table aTable (aNewTab, Table::Memory, 2);
  ScalarColumn<String> sc(aTable, "str");
  sc.put (0, "str1");
  sc.put (0, "s1");
  sc.put (1, "sstr2");
  tab.rwKeywordSet().defineTable ("Subtab", aTable);
}

void putColumnTest (Table& aTable)
{
  ScalarColumn<Int> ab(aTable,"Col-2");

  // put value 3 in rownr 5
  ab.put(5,3);
  AlwaysAssertExit(ab(5) == 3);

  // put value 4 in column
  ab.putColumn(ab.getColumn() + 1);
  AlwaysAssertExit (ab(5) == 4);
}

void copyTable (const Table& aTable)
{
  cout << "Try to rename and copy the table" << endl;
  Table tab(aTable);
  cout << "old name = " << Path(tab.tableName()).baseName();
  tab.rename ("mt_newname", Table::Scratch);
  AlwaysAssertExit (!tab.isColumnStored ("Colvirt"));
  cout << "     new name = " << Path(tab.tableName()).baseName() << endl;
  aTable.copy ("tMemoryTable_tmp.tabcp", Table::New);
  Table tabc("tMemoryTable_tmp.tabcp");
  cout << "copy name = " << Path(tabc.tableName()).baseName() << endl;
  AlwaysAssertExit (!tabc.isColumnStored ("Colvirt"));
  info(tabc);
}

void copyRefTable (const Table& aTable)
{
  cout << "Try to copy a referenced memory table" << endl;
  Table tab (aTable(aTable.col("Colvirt") < 10));
  AlwaysAssertExit (!tab.isColumnStored ("Colvirt"));
  tab.deepCopy ("tMemoryTable_tmp.tabcpr", Table::New);
  Table tabc("tMemoryTable_tmp.tabcpr");
  cout << "copy name = " << Path(tabc.tableName()).baseName() << endl;
  AlwaysAssertExit (!tabc.isColumnStored ("Colvirt"));
  info(tabc);
  cout << tab.dataManagerInfo() << endl;
  cout << tabc.dataManagerInfo() << endl;
}

void copyMemoryTable (const Table& aTable)
{
  cout << "Try to copy the table to a MemoryTable" << endl;
  Table tab(aTable);
  AlwaysAssertExit (!tab.isColumnStored ("Colvirt"));
  cout << "name = " << Path(tab.tableName()).baseName() << endl;
  Table tabc = tab.copyToMemoryTable ("tMemoryTable.dat");
  cout << "copy name = " << Path(tabc.tableName()).baseName() << endl;
  AlwaysAssertExit (!tabc.isColumnStored ("Colvirt"));
  info(tabc);
}

void copyMemoryTableSubSet (const Table& aTable)
{
  cout << "Try to copy a table subset to a MemoryTable" << endl;
  Table tab = aTable(aTable.col("Col-3"));
  Table tabc = tab.copyToMemoryTable ("tMemoryTable.subdat");
  cout << "copy name = " << Path(tabc.tableName()).baseName() << endl;
  info(tabc);
}