% Define all the styles used to produce XDSMs for MDO
% \definecolor{tableau0}{RGB}{31,119,180}
% \definecolor{tableau1}{RGB}{255,158,74}
% \definecolor{tableau2}{RGB}{103,191,92}
% \definecolor{tableau3}{RGB}{237,102,93}
% \definecolor{tableau4}{RGB}{148,103,189}
% \definecolor{tableau5}{RGB}{168,120,110}
% \definecolor{tableau6}{RGB}{237,151,202}
% \definecolor{tableau7}{RGB}{162,162,162}
% \definecolor{tableau8}{RGB}{205,204,93}
% \definecolor{tableau9}{RGB}{109,204,218}

\definecolor{tableau0}{RGB}{77, 121, 168}
\definecolor{tableau1}{RGB}{242, 142, 43}
\definecolor{tableau2}{RGB}{255, 87, 88}
\definecolor{tableau3}{RGB}{118, 183, 178}
\definecolor{tableau4}{RGB}{89, 161, 78}
\definecolor{tableau5}{RGB}{237, 201, 72}
\definecolor{tableau6}{RGB}{176, 121, 162}
\definecolor{tableau7}{RGB}{255, 157, 167}
\definecolor{tableau8}{RGB}{156, 116, 94}
\definecolor{tableau9}{RGB}{186, 176, 172}

\definecolor{optimization}{RGB}{204, 204, 255}
\definecolor{lp_optimization}{RGB}{204, 204, 255}
\definecolor{mdo}{RGB}{255, 204, 204}
\definecolor{analysis}{RGB}{204, 255, 204}
\definecolor{mda}{RGB}{255, 229, 204}
\definecolor{function}{RGB}{242, 204, 217}
\definecolor{metamodel}{RGB}{255, 252, 204}
\definecolor{doe}{RGB}{255, 229, 204}
\definecolor{implicitanalysis}{RGB}{1, 1, 1}


\tikzstyle{every node}=[font=\sffamily,align=center]

% Component types
\tikzstyle{Optimization} = [rounded rectangle,draw,fill=optimization,inner sep=6pt,minimum height=1cm,text badly centered]
\tikzstyle{LP_Optimization} = [rectangle,draw,fill=lp_optimization,inner sep=6pt,minimum height=1cm,text badly centered]
\tikzstyle{Analysis} = [rectangle,draw,fill=analysis,inner sep=6pt,minimum height=1cm,text badly centered]
\tikzstyle{ImplicitAnalysis} = [rectangle,draw,fill=implicitanalysis,inner sep=6pt,minimum height=1cm,text badly centered]
\tikzstyle{MDO} = [rectangle,draw,fill=mdo,inner sep=6pt,minimum height=1cm,text badly centered]
\tikzstyle{Function} = [rectangle,draw,fill=function,inner sep=6pt,minimum height=1cm,text badly centered]
\tikzstyle{MDA} = [rounded rectangle,draw,fill=mda,inner sep=6pt,minimum height=1cm,text badly centered]
\tikzstyle{Metamodel} = [rectangle,draw,fill=metamodel,inner sep=6pt,minimum height=1cm,text badly centered]
\tikzstyle{DOE} = [rounded rectangle,draw,fill=doe,inner sep=6pt,minimum height=1cm,text badly centered]
%\tikzstyle{OptFunction} = [rectangle,draw,fill=red!20,inner sep=6pt,minimum height=1cm,text badly centered]


%% A simple command to give the repeated structure look for components and data
% \tikzstyle{stack} = [double copy shadow]
\tikzstyle{stack} = [double copy shadow={shadow xshift=.75ex, shadow yshift=-.75ex}]
%% A simple command to fade components and data, e.g. demonstrating a sequence of steps in an animation
\tikzstyle{faded} = [draw=black!50,fill=white,text opacity=0.5]

%% Simple fading commands for the lines
\tikzstyle{fadeddata} = [color=black!20]
\tikzstyle{fadedprocess} = [color=black!50]

% **OLD** Component types for repeated structures (i.e. for parallel structures)
%\tikzstyle{Optimization_i} = [double copy shadow, Optimization]
%\tikzstyle{LP_Optimization_i} = [double copy shadow, LP_Optimization]
%\tikzstyle{Analysis_i} = [double copy shadow, Analysis]
%\tikzstyle{Function_i} = [double copy shadow, Function]
%\tikzstyle{MDA_i} = [double copy shadow, MDA]
%\tikzstyle{Metamodel_i} = [double copy shadow, Metamodel]
%\tikzstyle{DOE_i} = [double copy shadow, DOE]

% **OLD** Faded component types for, e.g. demonstrations of each step. We use these style definitions to "gray out" large parts of the diagram.
%\tikzstyle{Optimization_fade} = [Optimization,fill=blue!10,draw=black!30,text opacity=0.3]
%\tikzstyle{Analysis_fade} = [Analysis,fill=green!10,draw=black!30,text opacity=0.3]
%\tikzstyle{Function_fade} = [Function,fill=purple!10,draw=black!30,text opacity=0.3]
%\tikzstyle{MDA_fade} = [MDA,fill=orange!10,draw=black!30,text opacity=0.3]
%\tikzstyle{Metamodel_fade} = [Metamodel,fill=yellow!10,draw=black!30,text opacity=0.3]
%\tikzstyle{DOE_fade} = [DOE,fill=yellow!10,draw=black!30,text opacity=0.3]
%
%\tikzstyle{Optimization_i_fade} = [Optimization_i,fill=blue!10,draw=black!30,text opacity=0.3]
%\tikzstyle{Analysis_i_fade} = [Analysis_i,fill=green!10,draw=black!30,text opacity=0.3]
%\tikzstyle{Function_i_fade} = [Function_i,fill=purple!10,draw=black!30,text opacity=0.3]
%\tikzstyle{MDA_i_fade} = [MDA_i,fill=orange!10,draw=black!30,text opacity=0.3]
%\tikzstyle{Metamodel_i_fade} = [Metamodel_i,fill=yellow!10,draw=black!30,text opacity=0.3]
%\tikzstyle{DOE_i_fade} = [DOE_i,fill=yellow!10,draw=black!30,text opacity=0.3]

% Data types
\tikzstyle{DataInter} = [trapezium,trapezium left angle=75,trapezium right angle=105,draw,fill=black!10]
\tikzstyle{DataIO} = [trapezium,trapezium left angle=75,trapezium right angle=105,draw,fill=white]

% **OLD** Data types for repeated structures
%\tikzstyle{DataInter_i} = [double copy shadow, DataInter]
%\tikzstyle{DataIO_i} = [double copy shadow, DataIO]

% **OLD** Faded data types
%\tikzstyle{DataInter_fade} = [DataInter,draw=black!30,fill=white,text opacity=0.3]
%\tikzstyle{DataIO_fade} = [DataIO_i,draw=black!30,fill=white,text opacity=0.3]
%
%\tikzstyle{DataInter_i_fade} = [DataInter_i,draw=black!30,fill=white,text opacity=0.3]
%\tikzstyle{DataIO_i_fade} = [DataIO_i,draw=black!30,fill=white,text opacity=0.3]

% Edges
\tikzstyle{DataLine} = [color=black!40,line width=5pt,line cap=rect]
\tikzstyle{ProcessHV} = [-,line width=1pt,to path={-| (\tikztotarget)}]
\tikzstyle{ProcessHVA} = [->,line width=1pt,to path={-| (\tikztotarget)}]
\tikzstyle{ProcessTip} = [-,line width=1pt]

% **OLD** Faded edges
%\tikzstyle{DataLine_fade} = [DataLine,color=black!10]
%\tikzstyle{ProcessHV_fade} = [ProcessHV,color=black!30]
%\tikzstyle{ProcessTip_fade} = [ProcessTip,color=black!30]

% Matrix options
\tikzstyle{MatrixSetup} = [row sep=3mm, column sep=2mm]

% Declare a background layer for showing node connections
\pgfdeclarelayer{data}
\pgfdeclarelayer{process}
\pgfsetlayers{data,process,main}

% A new command to split the component text over multiple lines

\newcommand{\MultilineComponent}[2]
{
	\begin{minipage}{#1}
	\begin{center}
		#2
	\end{center}
	\end{minipage}
}

\newcommand{\TwolineComponent}[3]
{
	\begin{minipage}{#1}
	\begin{center}
		#2 \linebreak #3
	\end{center}
	\end{minipage}
}

\newcommand{\ThreelineComponent}[4]
{
	\begin{minipage}{#1}
	\begin{center}
		#2 \linebreak #3 \linebreak #4
	\end{center}
	\end{minipage}
}

% A new command to split the component text over multiple columns
\newcommand{\MultiColumnComponent}[5]
{
	\begin{minipage}{#1}
	\begin{center}
	#2 \linebreak #3
	\end{center}
	\begin{minipage}{0.49\textwidth}
	\begin{center}
	#4
	\end{center}
	\end{minipage}
	\begin{minipage}{0.49\textwidth}
	\begin{center}
	#5
	\end{center}
	\end{minipage}
	\end{minipage}
}

\def\arraystretch{1.3}
