File: tsgLoadConstructedPoints.m

package info (click to toggle)
tasmanian 8.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,852 kB
  • sloc: cpp: 34,523; python: 7,039; f90: 5,080; makefile: 224; sh: 64; ansic: 8
file content (58 lines) | stat: -rw-r--r-- 1,513 bytes parent folder | download | duplicates (2)
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
function tsgLoadConstructedPoints(lGrid, mX, mY)
%
%   tsgLoadConstructedPoints(lGrid, mX, mY)
%
% loads the combination of inputs (mX) and outputs (mY) into the grid
% the points don't need to be in any particular order, but
% the i-th row of mX has to correspond to the i-th row of mY
% the points must be aligned to the gird, but may come from
% any level, e.g., grid level 3 can accept points from level 4 or up
% see loadConstructedPoints() in the on-line manual
%
% NOTE: this will call the C++ method beginConstruction() which will
%       clear any currently set refinement
%
% INPUT:
%
% lGrid: a grid list created by tsgMakeXXX(...)
%
% mX : matrix of size N by number of dimensions
%
% mY : matrix of size N by number of outputs
%

[sFiles, sTasGrid] = tsgGetPaths();
[sFileG, sFileX, sFileV, sFileO, sFileW, sFileC, sFileL] = tsgMakeFilenames(lGrid);

sCommand = [sTasGrid,' -loadconstructed'];

sCommand = [sCommand, ' -gridfile ', sFileG];

tsgWriteMatrix(sFileX, mX);

sCommand = [sCommand, ' -xf ', sFileX];
lClean.sFileX = 1;

tsgWriteMatrix(sFileV, mY);

sCommand = [sCommand, ' -vf ', sFileV];
lClean.sFileV = 1;

[status, cmdout] = system(sCommand);

if (max(size(strfind(cmdout, 'ERROR'))) ~= 0)
    disp(cmdout);
    error('The tasgrid execurable returned an error, see above');
    return;
else
    if (~ isempty(cmdout))
        fprintf(1,['Warning: Command had non-empty output:\n']);
        disp(cmdout);
    end
end

if (exist('lClean'))
    tsgCleanTempFiles(lGrid, lClean);
end

end