function [U,x,OnN1,nsamp] = CalRose(U,x)

% Calculation file - Rosenbrock function
%
% This function calculations the sampling domain in other variables than its
% initial definition. Furthermore, it extracts the dependent variables from
% the solution vector of the nonlinear system of equations and calculates
% dependent variables which are not included in the nonlinear system.
%
% Written by Julian Straus, Trondheim 09.12.2018
%
% The main input and output is defined as
%       U:      Structure containing the sampling domain calculated using
%               several possible approaches for independent variables 
%               definition. The output includes as well the whole input.
%
%       x:      Structure containing the state variables and new calculated
%               variables which are not calculated inside the system of
%               nonlinear equations. The output includes as well the whole
%               input.
%
% The seconday output for post analysis is given:
%       OnN1:   Vector of ones with size nsamp x 1
%
%       nsamp:  Number of sampled points.
%
%
% The necessary input is defined as
%       ind:    Vector containing the indidces of the dependent variables
%               in x.
%
%       par:    Cell structure containing the parameters used in the 
%               calculation, output of the system.
%
%       scl:    Cell structure containing the scaling factors for each unit
%               operations. The assignment is given in par.ReactSec.
%
%       con:    Physical constants, must contain
%               .R      Ideal Gas constant
%       
%       opt:    Structure containing options.
%
%       Ver:    Structure containing options.
%
%       On1j:   Vector of ones with size 1 x j (Number of chemical
%               components.

% Calculation of the number of sampling points and of the independent 
% variables which are varied for the validation space
nsamp = size(U.tot,1);
OnN1  = ones(nsamp,1);

% Calculation of the varied independent variables
U.samp = U.tot;
U.Molfrac = U.tot;
U.PartPress = U.tot;

% Combination of the outlet values
x.red = x.tot;