TikZ – Creating Block Diagrams with Subdivided Blocks in TikZ

tikz-pgf

I'm trying to obtain something similar to the following sketch:
schema

The problem is how to draw the node E with the right dimensions to cover the four nodes below.

What I have right now:

\documentclass{article}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[
    block/.style={
      rectangle,
      rounded corners,
      inner sep=1em
    }
  ]
    
    \path node[block,white,fill=jeans] (mathsat) {MathSAT\strut};
    \path (mathsat.east) ++(2pt,0) node[block,anchor=west,white,fill=jeans] 
      (z3) {Z3\strut};
    \path (z3.east) ++(2pt,0) node[block,anchor=west,white,fill=jeans] 
      (minisat) {MiniSAT\strut};
    \path (minisat.east) ++(2pt,0) node[block,anchor=west,white,fill=jeans] 
      (cmsat) {CryptoMiniSAT\strut};

\end{tikzpicture}
\end{document}

which just draws the four blocks below.

How do I draw a node above the four blocks of the exact width?

Best Answer

The fit and matrix libraries are really helping. Note that you have to use \hphantom on your first two rows if you want the fitting to behave properly. If you chose to have all columns of the same size, this will not be mandatory anymore.

matrix of nodes and fit

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,fit}

\begin{document}
    \begin{tikzpicture}
        \tikzset{block/.style={
            rounded corners, fill=cyan,text=white,inner sep=0pt,outer sep=0pt}}
    
        \matrix (m) [matrix of nodes,
                     nodes in empty cells,
                     nodes={rounded corners,
                            minimum height=1cm, 
                            inner sep=1em,
                            outer sep=0pt},
                     column sep=1mm,
                        row sep=1mm,
                        row 1/.style = {nodes={minimum height=2cm}},
                        row 2/.style = {nodes={minimum height=3cm}},
                        row 3/.style = {nodes={fill=cyan, text=white}},
                     ]
        {   
            \hphantom{MathSAT} & \hphantom{Z3} & \hphantom{MiniSAT} & \hphantom{CryptoMiniSAT}\\
            \hphantom{MathSAT} & \hphantom{Z3} & \hphantom{MiniSAT} & \hphantom{CryptoMiniSAT}\\        MathSAT & Z3 & MiniSAT & CryptoMiniSAT \\
            };
        
        \node[block,fit=(m-1-1)(m-1-4)]{YOUR F NODE};
        \node[block,fit=(m-2-1)(m-2-4)]{YOUR E NODE};
    \end{tikzpicture}
\end{document}