function mesh = makeTRIvalid( mesh )
    if mesh.globalProps.trinodesvalid, return; end
    if ~mesh.globalProps.prismnodesvalid, return; end
    mesh.globalProps.trinodesvalid = true;

    numprismnodes = size(mesh.prismnodes,1);
    mesh.nodes = (mesh.prismnodes(1:2:numprismnodes,:) ...
                  + mesh.prismnodes(2:2:numprismnodes,:))/2;
end

    