Mercurial > hg > camir-aes2014
annotate toolboxes/FullBNT-1.0.7/bnt/potentials/@cgpot/cgpot.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function pot = cgpot(ddom, cdom, node_sizes, can, mom, subtype) |
wolffd@0 | 2 % CPOT Make a canonical CG potential. |
wolffd@0 | 3 % function pot = cgpot(ddom, cdom, node_sizes, can, mom, subtype) |
wolffd@0 | 4 % |
wolffd@0 | 5 % node_sizes(i) is the size of the i'th node. |
wolffd@0 | 6 % can and mom default to 0s. |
wolffd@0 | 7 % subtype defaults to 'c'. |
wolffd@0 | 8 |
wolffd@0 | 9 if nargin < 6, subtype = 'c'; end |
wolffd@0 | 10 |
wolffd@0 | 11 pot.ddom = ddom; |
wolffd@0 | 12 pot.cdom = cdom; |
wolffd@0 | 13 node_sizes = node_sizes(:)'; % row vectors print better |
wolffd@0 | 14 pot.domain = myunion(ddom, cdom); |
wolffd@0 | 15 pot.dsizes = node_sizes(pot.ddom); |
wolffd@0 | 16 pot.dsize = prod(node_sizes(pot.ddom)); |
wolffd@0 | 17 pot.csizes = node_sizes(pot.cdom); |
wolffd@0 | 18 pot.csize = sum(node_sizes(pot.cdom)); |
wolffd@0 | 19 pot.subtype = subtype; |
wolffd@0 | 20 |
wolffd@0 | 21 if nargin < 4 |
wolffd@0 | 22 can = cell(1, pot.dsize); |
wolffd@0 | 23 for i=1:pot.dsize |
wolffd@0 | 24 can{i} = cpot(cdom, node_sizes(cdom)); |
wolffd@0 | 25 end |
wolffd@0 | 26 end |
wolffd@0 | 27 pot.can = can; |
wolffd@0 | 28 |
wolffd@0 | 29 if nargin < 5 |
wolffd@0 | 30 mom = cell(1, pot.dsize); |
wolffd@0 | 31 for i=1:pot.dsize |
wolffd@0 | 32 mom{i} = mpot(cdom, node_sizes(cdom)); |
wolffd@0 | 33 end |
wolffd@0 | 34 end |
wolffd@0 | 35 pot.mom = mom; |
wolffd@0 | 36 |
wolffd@0 | 37 pot = class(pot, 'cgpot'); |
wolffd@0 | 38 |