MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / Load

Method Load

comp/gridfunction.cpp:570–649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568
569 template <class SCAL>
570 void S_GridFunction<SCAL> :: Load (istream & ist, int mdcomp)
571 {
572 static Timer t ("GridFunctionLoad"); RegionTimer r (t);
573
574 if (mdcomp == -1)
575 {
576 for (int comp = 0; comp < GetMultiDim(); comp++)
577 Load (ist, comp);
578 return;
579 }
580 const auto& ma = fespace->GetMeshAccess();
581 auto comm = ma->GetCommunicator();
582 if (comm.Size() == 1)
583 {
584 const FESpace & fes = *GetFESpace();
585 Array<DofId> dnums;
586
587 // for (NODE_TYPE nt = NT_VERTEX; nt <= NT_CELL; nt++)
588 for (NODE_TYPE nt : { NT_VERTEX, NT_EDGE, NT_FACE, NT_CELL })
589 {
590 int nnodes = ma->GetNNodes (nt);
591
592
593 Array<Vec<8, int> > nodekeys;
594 Array<int> pnums, compress;
595 for(int i = 0; i < nnodes; i++)
596 {
597 fes.GetDofNrs (NodeId(nt, i), dnums);
598 if (dnums.Size() == 0) continue;
599
600 switch (nt)
601 {
602 case NT_VERTEX: pnums.SetSize(1); pnums[0] = i; break;
603 case NT_EDGE: pnums = ma->GetEdgePNums (i); break;
604 case NT_FACE: pnums = ma->GetFacePNums (i); break;
605 case NT_CELL: pnums = ma->GetElVertices (i); break;
606 default:
607 __assume(false);
608 }
609 Vec<8> key;
610 key = -1;
611 for (int j = 0; j < pnums.Size(); j++)
612 key[j] = pnums[j];
613 nodekeys.Append (key);
614 compress.Append (i);
615 }
616
617 nnodes = nodekeys.Size();
618
619 Array<int> index(nnodes);
620 for( int i = 0; i < index.Size(); i++) index[i] = i;
621
622 QuickSortI (nodekeys, index, MyLess<8>);
623
624 for( int i = 0; i < nnodes; i++)
625 {
626 fes.GetDofNrs (NodeId(nt, compress[index[i]]), dnums);
627 Vector<SCAL> elvec(dnums.Size()*fes.GetDimension());

Callers

nothing calls this directly

Calls 14

GetMultiDimFunction · 0.85
NodeIdClass · 0.85
SetElementVectorFunction · 0.85
GetMeshAccessMethod · 0.80
SetParallelStatusMethod · 0.80
CumulateMethod · 0.80
LoadFunction · 0.70
GetFESpaceFunction · 0.70
GetCommunicatorMethod · 0.45
SizeMethod · 0.45
GetDofNrsMethod · 0.45
SetSizeMethod · 0.45

Tested by

no test coverage detected