I am trying to create a composite matrix -  the relevant snippet of the code is - <div><div><br></div><div>Mat KK, AA[3];</div></div><div>ierr = MatDuplicate(KFullMat,MAT_COPY_VALUES,&AA[0]);CHKERRQ(ierr);<br></div><div>
<div>ierr = MatDuplicate(CFullMat,MAT_COPY_VALUES,&AA[1]); CHKERRQ(ierr);</div><div>ierr = MatDuplicate(MFullMat,MAT_COPY_VALUES,&AA[2]); CHKERRQ(ierr);</div><div><br></div><div>ierr = MatScale(AA[1],iomega);CHKERRQ(ierr);</div>
<div>ierr = MatScale(AA[2],-forcomega2); CHKERRQ(ierr);</div><div><br></div><div>ierr = MatCreateComposite(PETSC_COMM_WORLD,3,AA,&KK); CHKERRQ(ierr);</div><div>ierr = MatCompositeMerge(KK); CHKERRQ(ierr);</div><div><br>
</div><div>This crashes with the error at the end of the message. Do you have any ideas about what might be causing this?  Is there any other debugging output I should send - log_summary perhaps?</div><div><br></div><div>
-Nachiket</div><div><br></div><div><div>[0]PETSC ERROR: --------------------- Error Message ------------------------------------</div><div>[0]PETSC ERROR: Object is in wrong state!</div><div>[0]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on argument 1 "mat" before MatAssemblyBegin()!</div>
<div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: Petsc Release Version 3.3.0, Patch 2, Fri Jul 13 15:42:00 CDT 2012 </div><div>[0]PETSC ERROR: See docs/changes/index.html for recent updates.</div>
<div>[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div><div>[0]PETSC ERROR: See docs/index.html for manual pages.</div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[0]PETSC ERROR: /home/gokhale/WAIGEN/GDEB-WAIGEN2012/bin/waigen on a linux-gcc named <a href="http://asd1.wai.com">asd1.wai.com</a> by gokhale Thu Dec 13 12:54:51 2012</div><div>[0]PETSC ERROR: Libraries linked from /opt/petsc/petsc-3.3-p2/linux-gcc-g++-mpich-mumps-complex-debug/lib</div>
<div>[0]PETSC ERROR: Configure run at Mon Oct 29 18:41:24 2012</div><div>[2]PETSC ERROR: --------------------- Error Message ------------------------------------</div><div>[2]PETSC ERROR: Object is in wrong state!</div><div>
[2]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on argument 1 "mat" before MatAssemblyBegin()!</div><div>[2]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[2]PETSC ERROR: Petsc Release Version 3.3.0, Patch 2, Fri Jul 13 15:42:00 CDT 2012 </div><div>[2]PETSC ERROR: See docs/changes/index.html for recent updates.</div><div>[2]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div>
<div>[2]PETSC ERROR: See docs/index.html for manual pages.</div><div>[2]PETSC ERROR: [3]PETSC ERROR: --------------------- Error Message ------------------------------------</div><div>[3]PETSC ERROR: Object is in wrong state!</div>
<div>[3]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on argument 1 "mat" before MatAssemblyBegin()!</div><div>[3]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[3]PETSC ERROR: Petsc Release Version 3.3.0, Patch 2, Fri Jul 13 15:42:00 CDT 2012 </div><div>[3]PETSC ERROR: See docs/changes/index.html for recent updates.</div><div>[3]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div>
<div>[3]PETSC ERROR: See docs/index.html for manual pages.</div><div>[3]PETSC ERROR: ------------------------------------------------------------------------</div><div>[3]PETSC ERROR: /home/gokhale/WAIGEN/GDEB-WAIGEN2012/bin/waigen on a linux-gcc named <a href="http://asd1.wai.com">asd1.wai.com</a> by gokhale Thu Dec 13 12:54:51 2012</div>
<div>[3]PETSC ERROR: [0]PETSC ERROR: Configure options --with-x=0 --with-mpi=1 --download-mpich=yes --with-x11=0 --with-debugging=1 --with-clanguage=C++ --with-shared-libraries=1 --download-mumps=yes --download-f-blas-lapack=1 --download-parmetis=1 --download-metis --download-scalapack=1 --download-blacs=1 --with-cmake=/usr/bin/cmake28 --with-scalar-type=complex</div>
<div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: MatAssemblyBegin() line 4683 in /opt/petsc/petsc-3.3-p2/src/mat/interface/matrix.c</div><div>[0]PETSC ERROR: MatCreateComposite() line 440 in /opt/petsc/petsc-3.3-p2/src/mat/impls/composite/mcomposite.c</div>
<div>[0]PETSC ERROR: main() line 141 in src/examples/waigen.c</div><div>------------------------------------------------------------------------</div><div>[2]PETSC ERROR: /home/gokhale/WAIGEN/GDEB-WAIGEN2012/bin/waigen on a linux-gcc named <a href="http://asd1.wai.com">asd1.wai.com</a> by gokhale Thu Dec 13 12:54:51 2012</div>
<div>[2]PETSC ERROR: Libraries linked from /opt/petsc/petsc-3.3-p2/linux-gcc-g++-mpich-mumps-complex-debug/lib</div><div>[2]PETSC ERROR: Configure run at Mon Oct 29 18:41:24 2012</div><div>[2]PETSC ERROR: Configure options --with-x=0 --with-mpi=1 --download-mpich=yes --with-x11=0 --with-debugging=1 --with-clanguage=C++ --with-shared-libraries=1 --download-mumps=yes --download-f-blas-lapack=1 --download-parmetis=1 --download-metis --download-scalapack=1 --download-blacs=1 --with-cmake=/usr/bin/cmake28 --with-scalar-type=complex</div>
<div>[2]PETSC ERROR: ------------------------------------------------------------------------</div><div>Libraries linked from /opt/petsc/petsc-3.3-p2/linux-gcc-g++-mpich-mumps-complex-debug/lib</div><div>[3]PETSC ERROR: Configure run at Mon Oct 29 18:41:24 2012</div>
<div>[3]PETSC ERROR: Configure options --with-x=0 --with-mpi=1 --download-mpich=yes --with-x11=0 --with-debugging=1 --with-clanguage=C++ --with-shared-libraries=1 --download-mumps=yes --download-f-blas-lapack=1 --download-parmetis=1 --download-metis --download-scalapack=1 --download-blacs=1 --with-cmake=/usr/bin/cmake28 --with-scalar-type=complex</div>
<div>[3]PETSC ERROR: ------------------------------------------------------------------------</div><div>[3]PETSC ERROR: MatAssemblyBegin() line 4683 in /opt/petsc/petsc-3.3-p2/src/mat/interface/matrix.c</div><div>[3]PETSC ERROR: application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0</div>
<div>[cli_0]: aborting job:</div><div>application called MPI_Abort(MPI_COMM_WORLD, 73) - process 0</div><div>[2]PETSC ERROR: MatAssemblyBegin() line 4683 in /opt/petsc/petsc-3.3-p2/src/mat/interface/matrix.c</div><div>[2]PETSC ERROR: MatCreateComposite() line 440 in /opt/petsc/petsc-3.3-p2/src/mat/impls/composite/mcomposite.c</div>
<div>MatCreateComposite() line 440 in /opt/petsc/petsc-3.3-p2/src/mat/impls/composite/mcomposite.c</div><div>[3]PETSC ERROR: main() line 141 in src/examples/waigen.c</div><div>[2]PETSC ERROR: main() line 141 in src/examples/waigen.c</div>
<div>application called MPI_Abort(MPI_COMM_WORLD, 73) - process 3</div><div>application called MPI_Abort(MPI_COMM_WORLD, 73) - process 2</div><div>[cli_2]: aborting job:</div><div>application called MPI_Abort(MPI_COMM_WORLD, 73) - process 2</div>
<div>[cli_3]: aborting job:</div><div>application called MPI_Abort(MPI_COMM_WORLD, 73) - process 3</div><div>[1]PETSC ERROR: --------------------- Error Message ------------------------------------</div><div>[1]PETSC ERROR: Object is in wrong state!</div>
<div>[1]PETSC ERROR: Must call MatXXXSetPreallocation() or MatSetUp() on argument 1 "mat" before MatAssemblyBegin()!</div><div>[1]PETSC ERROR: ------------------------------------------------------------------------</div>
<div>[1]PETSC ERROR: Petsc Release Version 3.3.0, Patch 2, Fri Jul 13 15:42:00 CDT 2012 </div><div>[1]PETSC ERROR: See docs/changes/index.html for recent updates.</div><div>[1]PETSC ERROR: See docs/faq.html for hints about trouble shooting.</div>
<div>[1]PETSC ERROR: See docs/index.html for manual pages.</div><div>[1]PETSC ERROR: ------------------------------------------------------------------------</div><div>[1]PETSC ERROR: /home/gokhale/WAIGEN/GDEB-WAIGEN2012/bin/waigen on a linux-gcc named <a href="http://asd1.wai.com">asd1.wai.com</a> by gokhale Thu Dec 13 12:54:51 2012</div>
<div>[1]PETSC ERROR: Libraries linked from /opt/petsc/petsc-3.3-p2/linux-gcc-g++-mpich-mumps-complex-debug/lib</div><div>[1]PETSC ERROR: Configure run at Mon Oct 29 18:41:24 2012</div><div>[1]PETSC ERROR: Configure options --with-x=0 --with-mpi=1 --download-mpich=yes --with-x11=0 --with-debugging=1 --with-clanguage=C++ --with-shared-libraries=1 --download-mumps=yes --download-f-blas-lapack=1 --download-parmetis=1 --download-metis --download-scalapack=1 --download-blacs=1 --with-cmake=/usr/bin/cmake28 --with-scalar-type=complex</div>
<div>[1]PETSC ERROR: ------------------------------------------------------------------------</div><div>[1]PETSC ERROR: MatAssemblyBegin() line 4683 in /opt/petsc/petsc-3.3-p2/src/mat/interface/matrix.c</div><div>[1]PETSC ERROR: MatCreateComposite() line 440 in /opt/petsc/petsc-3.3-p2/src/mat/impls/composite/mcomposite.c</div>
<div>[1]PETSC ERROR: main() line 141 in src/examples/waigen.c</div><div>application called MPI_Abort(MPI_COMM_WORLD, 73) - process 1</div><div>[cli_1]: aborting job:</div><div>application called MPI_Abort(MPI_COMM_WORLD, 73) - process 1</div>
</div><div><br></div><div><br></div><div><br></div></div>